emacs-devel
[Top][All Lists]
Advanced

[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: Tue, 5 May 2020 10:38:38 +0100

On Tue, May 5, 2020 at 2:22 AM Vladimir Sedach <address@hidden> wrote:
> João Távora <address@hidden> writes:
> > I liked that your example tried to bring a real-life problem
> > to the table, but I can't make sense of it.
>
> Let me try a different way:
>
> 1. Library ABC version 1 does not define or export FUNC1.
> 2. Package XYZ :uses ABC, importing all of ABC's exported symbols.
> 3. Package XYZ defines FUNC1 for internal use. There is no problem.
> 4. Library ABC version 1.1 defines and exports FUNC1.
> 5. When XYZ is loaded with ABC version 1.1, XYZ unintentionally
>    overrides the definition of FUNC1 for all users of ABC.

In which implementation of CL? In the ones I know, step 5
will get you an error, exactly describing the conflict,
which you handle interactively or automhatically.
You can choose to shadow import the symbol, unintern
the conflicting symbol, or give up loading XYZ in its current
form.  You can reconsider :use for that new version of the
library or rename FUNC1 (which is for internal use anyway)
That's quite different of saying that :use is dangerous or
anything.  It's what it is if you know what it does, which is
saying "I want all of that API's symbols accessible here
without special qualification".  It's like in primary school:
remember those times when they merged two classes
and some kid in the other class had the same first name as
you? Same deal, basically.

BTW, what you described as dangerous is exactly what
happens in Elisp, _not_ Common Lisp.

> Perhaps that makes it more clear.

Nope.

> >> Common Lisp does not do a good job of this, because whether or not a
> >> symbol's package prefix is printed depends on the current package you
> >> are in when printing.
> > How is that a flaw?
> You just pointed it out:

I fail to see where. I think you'll agree that a  Vlamidir in emacs-devel
is not the same as a Vladimir somewhere else.  To communicate to
someone that I really do mean you, I wither print the full qualifying name
or I have to agree beforehand on a common frame of reference.  In CL,
that's *PACKAGE*. Again, if you only have one namespace you
don't have that problem.  But then you don't have namespaces, right?   :-)

João



reply via email to

[Prev in Thread] Current Thread [Next in Thread]