emacs-devel
[Top][All Lists]
Advanced

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

Re: Help sought understanding shorthands wrt modules/packages


From: Helmut Eller
Subject: Re: Help sought understanding shorthands wrt modules/packages
Date: Sun, 30 Oct 2022 21:16:17 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

On Sun, Oct 30 2022, Gerd Möllmann wrote:

> So, I guess my first question is: does anyone here think shorthands are
> a substitute got packages, and if so could you please share your thought
> why, and how one would use them for that?  If not, it might also be
> helpful to know why not.

I think that shorthands do reduce the visual clutter in the source text
a bit.  And that's about all they do.

CL-like packages also provide runtime data structures to
export/import/inherit symbols between packages.  Obviously shorthands
can't do that.

In CL, it's also possible to create "empty" packages, i.e., packages
that don't import symbols from the CL package.  With this, one can
create a private function +.  That's also not possible with shorthands.

> And my second question os: Because I don't get it, I'm considering the
> possibility that shorthands are still incomplete, and some features are
> missing that would make it a substitute for a module system.  Something
> that's not documented anywhere, apparently.  If so, what is it?  Or
> where is it described?  Or does someone have an idea?  You know what I
> mean.

One thing that was talked about in the past is something like "local
shorthands".  I think the idea is that a certain prefix is only active
in a certain region of the text.  Preferably delimited by an sexp (and
not by special tokens as IN-PACKAGE in CL).  Or maybe it was about doing
something like namespace defaulting in XML.

I don't know if this is documented anywhere.  My impression was that
shorthands appeared out of the blue.  I also had the impression that
nobody liked the name "shorthands" much; or maybe that was just me :-).

[...]
> Or am I going nuts and overlooking the obvious?

Well, its pretty obvious that RMS doesn't like CL packages.

The other obvious problem are Lisp macros: macros make it darn hard to
introduce a "real" module system as in Python or Haskell.  I think the
options are:

 1. continue to use prefixes
 2. adopt half measures like shortands
 3. add namespaces to symbols, like CL or XML; keeps macros simple, but
    doesn't support renaming or aliases
 4. introduce hygienic macros as in Scheme

I think 4. is technically too difficult.

There may also be technical problems with 3., but the CL community
probably knows them and the workarounds.  But I think 3. will not happen
mainly for political/ideological reasons.

Helmut




reply via email to

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