[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Imports / inclusion of s.el into Emacs

From: João Távora
Subject: Re: Imports / inclusion of s.el into Emacs
Date: Wed, 13 May 2020 10:33:22 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.91 (gnu/linux)

Richard Stallman <address@hidden> writes:

> [[[ To any NSA and FBI agents reading my email: please consider    ]]]
> [[[ whether defending the US Constitution against all enemies,     ]]]
> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
>   > This means it's hard to do automatic checking of consistency in naming,
> That is an abstract concept, and I can understand it abstractly,
> but I don't know concretely what that would do.

You're right, it is abstract.  So let me explain what I meant with a
real-life analogy.  A namespace facility is for managing different
things with the same name in distinct contexts.  At some point you may
want to merge two contexts for convenience, much like the way teachers
will bring two smaller classes together on a class trip.  In those
occasions, a better equipped namespacing facility will have the means to
detect a possible clash in names, and warn the teachers explicitly that
there are now two kids known as "Jimmy".  The teachers may elect to:

- Rename both Jimmys
- Rename just of the Jimmys
- Let one of the Jimmy's be "shadowed" by the other (poor Jimmy...)
- Evict one of the Jimmy's from the class (harsher still)
- Abort the class trip entirely

In all of this example, each Jimmy keeps its identity (i.e. renaming him
doesn't change who he is).

It's these kinds of choices that a good namespacing facility like CL
packages give the user.  It's easier to implement them there because
each namespace is a first-class object: it can be queried
and modified programatically.

In shorthand.el, as in Elisp, a namespace is just a concept that is
managed entirely in the programmer's mind.

However, that doesn't mean conflicts can't arise in shorthand.el,
because naming conflicts are a hazard that comes with naming itself.

Say that you are using the symbol RICHARD-STALLMAN-* symbols from
richard-stallman.el happily in your myprogram.el as RMS-*.

Then, you realize you need to calculate the "Root Mean Square Error", a
mathematical concept, and you load a library mathematical.el where that
is done by the RMS-ERROR function.

You will have a problem, because if you type RMS-ERROR the system will
think you mean RICHARD-STALLMAN-ERROR, a function that may or may not
exist, but at any rate is not the one you intended.

This is why we probably need special syntax to "escape" the renaming, so
that you _can_ call RMS-ERROR from myprogram.el without the
aforementioned problem, perhaps by writing it ##RMS-ERROR or something
like that.  Another option is to give up on RMS-ERROR completely, or
convince the authors of mathematical.el to give their symbols another

At any rate, and this was my main point, shorthand.el is _not_ designed
to warn you about these conflicts: it is just a very dumb renaming
system, and lets you shoot yourself in the foot.

However, the argument can be made that Elisp _already_ lets you shoot
yourself in the foot with names, and Elisp programmers will presumably
know to take precautions anyway.  The opponents of CL packages will
probably also argue that the CL package facility has too broad an array
of choices which confuses the beginner programmer.

>   > However, if people are looking for other constructs to manage
>   > namespaces, it very much possible to develop shorthand.el so that you
>   > can have:
>   >    (shorthand-in-namespace FOO :as "f")
> What would that do?  I see values as argunments but what do they mean?

This enacts the shorhand rule "^f-" -> "foo-" for the following forms:

(f-bar)                                         ;; this really does mean (f-bar)
(shorthand-in-namespace foo :as "f")
(f-bar)                                         ;; but this means (foo-bar)
(shorthand-in-namespace foo :as "heyhey")
(heyhey-bar)                                    ;; this also means (foo-bar)
(f-bar)                                         ;; this again means (f-bar)


reply via email to

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