[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Proper namespaces in Elisp
From: |
João Távora |
Subject: |
Re: Proper namespaces in Elisp |
Date: |
Sat, 9 May 2020 20:11:05 +0100 |
On Sat, May 9, 2020 at 7:39 PM Daniel Colascione <address@hidden> wrote:
>
> On 5/9/20 11:35 AM, João Távora wrote:
> > On Sat, May 9, 2020 at 7:32 PM Daniel Colascione <address@hidden> wrote:
> >>
> >>
> >>
> >> On 5/9/20 11:23 AM, João Távora wrote:
> >>> On Sat, May 9, 2020 at 6:45 PM Daniel Colascione <address@hidden
> >>> <mailto:address@hidden>> wrote:
> >>>
> >>>
> >>> Can you give a concrete example of a situation in which it'd be
> >>> useful to
> >>> do that? I think other people on the thread are right about
> >>> discouraging
> >>> bulk naked symbol imports.
> >>>
> >>>
> >>> For a submodule that you do control, it's not such a bad idea.
> >>
> >> Concrete example? If you want inheritance, you can get it with EIEIO.
> >
> > When writing a namespaced foo-tests.el library for your namespaced
> > foo.el library, for example. Or for a big enough foo program, a
> > foo-utils.el
> > that exports utils that only foo.el needs and noone else.
>
> Why not just re-enter the same namespace in your test file then?
> What problem are you actually trying to solve here?
In my foo-test.el file I have definitions, too. I don't want those definitions
to enter my foo namespace. It's very simple to follow.
I don't know what you call module inheritance. Look, you know the CL package
system right? I'll just speak CL then, if you don't mind:
;; foo-utils .lisp
(defpackage :foo-utils (:use :cl) (:export #:add-two))
(in-package :foo-utils)
(defun contorted-two-adder (x) (+ 1 1 x))
(defun add-two (x) (contorted-two-adder x))
;; foo.lisp
(defpackage :foo (:use :cl :foo-utils) (:export #:bar))
(in-package :foo)
(defun bar () (add-two 40))
;; foo-tests.lisp
(defpackage :foo-tests (:use :cl :foo))
(in-package :foo-tests)
(defun check-forty-two-ness () (unless (eq (bar) 42)) (error "oh noes")))
Hope I didn't make many mistakes typing this in Gmail...
> package name prefix length, you can fix it with symbol rewriting without
> a ton of other complexity. I don't see a *need* for module inheritance
Again I don't know what you call "module inheritance". Maybe we're
just mis-communicating. I'm just describing bog-standard "hide the
implementation" stuff. I was suggesting reasonable uses of :USE, or
what I think you called "bulk symbol imports", i.e. merging two
namespaces.
João
- Re: Proper namespaces in Elisp, (continued)
- Re: Proper namespaces in Elisp, Vladimir Sedach, 2020/05/08
- Re: Proper namespaces in Elisp, Daniel Colascione, 2020/05/08
- Re: Proper namespaces in Elisp, Andrea Corallo, 2020/05/09
- Re: Proper namespaces in Elisp, Daniel Colascione, 2020/05/09
- Re: Proper namespaces in Elisp, Andrea Corallo, 2020/05/09
- Re: Proper namespaces in Elisp, Daniel Colascione, 2020/05/09
- Re: Proper namespaces in Elisp, João Távora, 2020/05/09
- Re: Proper namespaces in Elisp, Daniel Colascione, 2020/05/09
- Re: Proper namespaces in Elisp, João Távora, 2020/05/09
- Re: Proper namespaces in Elisp, Daniel Colascione, 2020/05/09
- Re: Proper namespaces in Elisp,
João Távora <=
- Re: Proper namespaces in Elisp, Andrea Corallo, 2020/05/09
- Re: Proper namespaces in Elisp, Daniel Colascione, 2020/05/09
- Re: Proper namespaces in Elisp, Andrea Corallo, 2020/05/09
- Why :USE sucks in the Common Lisp package system, phoe, 2020/05/09
- Re: Why :USE sucks in the Common Lisp package system, João Távora, 2020/05/09
- Re: Why :USE sucks in the Common Lisp package system, phoe, 2020/05/09
- Re: Why :USE sucks in the Common Lisp package system, Daniel Colascione, 2020/05/09
- Re: Why :USE sucks in the Common Lisp package system, phoe, 2020/05/09
- Re: Why :USE sucks in the Common Lisp package system, João Távora, 2020/05/09
- Re: Why :USE sucks in the Common Lisp package system, phoe, 2020/05/10