unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Matt Armstrong <matt@rfc20.org>
To: "Gerd Möllmann" <gerd.moellmann@gmail.com>,
	"Richard Stallman" <rms@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Help sought understanding shorthands wrt modules/packages
Date: Tue, 22 Nov 2022 11:37:22 -0800	[thread overview]
Message-ID: <871qpubx1p.fsf@rfc20.org> (raw)
In-Reply-To: <m2cz9tvo4m.fsf@Mini.fritz.box>

Gerd Möllmann <gerd.moellmann@gmail.com> writes:

>> The grave problem of :USE in CL packages could be fixed by replacing
>> it with a new construct that specifies a list of symbols to be
>> inherited from each other package, perhaos with renaming.
>
> I fail to understand the "grave" problem, sorry.  Could you please give
> a more concrete example?

A few weeks ago, in this thread or another, I attempted to explain my
understanding of the point Richard was raising.  As far as I can tell I
still share the same concern Richard raises.

The issue is that `(use-package "A")' brings all of A's exported symbols
into the current namespace, and so allows them to be used unqualified.
This implies that any addition to a package A's exported symbol list has
a chance of breaking code in any package that "use-package"'s it.  The
breakage takes the form of an introduced ambiguity.

This is a problem for "programming in the large".  If package's can't
add new things without risking breaking their users then the approach is
arguably worse than Emacs' current approach, at least in this respect.
Adding a new name for a new piece of functionality is one of the most
common ways packages evolve over time.


> BTW, in CL, if you don't want to use-package you can also import just
> the list of symbols you want.  Without renaming, but I guess that
> could be added, if somone wants that.  (I mention the idea of renaming
> in cl-packages.org, BTW, on the branch, but I'm still not sure it's
> worth it.)

Yes, Common Lisp provides ways to fix things *after* the breakage
occurs, but the harm comes with the breakage, and is an inevitable
consequence of the design.

Yes, the danger can be avoided by refraining from using `use-package' at
all.  This is the root my suggestion to consider CL packages for Emacs
but subtract `use-package'.

Yes, this kind of problem exists not only in Common Lisp but many other
languages, to the extent that some might come to believe this sort of
problem feels "natural" or is perhaps worth it for the convenience of
using unqualified names from other packages.  Python's "from foo
import*" is like CL's use-package and is now widely considered poor
style in the Python community (for the reasons I've stated).  Guile has
something like Common Lisp, with the same problem and the same kinds of
mitigating workarounds.  Ada has "use" with semantics similar to CL's.
Perl has "use" but, presumably through experience, recognized a problem
and has a "use VERSION" mechanism to limit potential harm from API
changes.  And on and on.

The argument is that all of these languages are all flawed in the same
way, and that a package/module system designed today should aim for
better.

There are languages that avoid this problem.  Java avoids it, as does
Go, and as far as I can tell Rust does too.  These languages simply do
not providing a way to slurp entire namespaces into other namespaces.
In these languages referring to names in other packages requires either
a package name qualifier, which can be renamed locally to something
short if desired, or by explicitly pulling individual names, one by one,
into the current scope.  With this there is no way for an addition of a
name in one package to cause a naming conflict or ambiguity in any
other.


>> Eli wrote:
>>
>>   > Moreover, from my POV, the jury is still out on the question of
>>   > whether we at all need packages in Emacs.  "Programming in the large"
>>   > doesn't sound very relevant to how Emacs Lisp is used.
>>
>> I share this feeling, except that I take it a bit further.  In the
>> 1980s I thought about whether we should have packages in Emacs, and
>> concluded that using a naming conventions is simpler, easier and more
>> flexible.  So I chose that.
>>
>> If CL packages were unproblematical, I'd say, "Sure, why not?  We
>> aren't desperate to keep Emacs small nowadays."  But they are
>> problematical, and that is a reason to choose to do without them.
>
> Please spend some effort to explain the problematic cases.

Done, I think.  I suspect you already understood the point, but merely
disagree about its importance?

To Eli's "jury is still out" point:

So far I have not seen a clear description of the problems with Emacs'
current approach, so there is not even a common understanding of what
the problems are, much less any consensus over how serious they are.
Without that, I think there is little hope of weighing different
alternatives productively.

As far as Common Lisp style packages, well, Common Lisp is a stable set
of compromises designed to unify disparate lisp implementations in the
80's.  It is stable and well understood, which has some benefits.  But
it is not clear to me that, when considering designs for Emacs today,
that there is any sort of "implied fitness for purpose" that comes from
Common Lisp designs.  The question and problem of adding a packaging
system to Emacs today strikes me as a very different thing from the
kinds of issues and problems originally considered in the 80's for
Common Lisp.  Specifically, back then "use-package" may have been a
compromise seen as a necessary, pragmatic, but suboptimal solution to
some problem of the day (e.g. perhaps making old code work without much
change while still retrofitting a package system).  It isn't obvious to
me that Emacs has the same problem(s) or that it should, necessarily,
adopt the same solutions.



  parent reply	other threads:[~2022-11-22 19:37 UTC|newest]

Thread overview: 125+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-30  6:45 Help sought understanding shorthands wrt modules/packages Gerd Möllmann
2022-10-30  8:38 ` tomas
2022-10-30  8:54   ` Eli Zaretskii
2022-10-30  9:14     ` tomas
2022-10-30 10:26       ` Gerd Möllmann
2022-10-30 10:52         ` Eli Zaretskii
2022-10-30 11:24           ` Is there a need for a module system Gerd Möllmann
2022-10-30 11:38             ` Eli Zaretskii
2022-10-30 14:03               ` Gerd Möllmann
2022-10-30 10:40       ` Help sought understanding shorthands wrt modules/packages Eli Zaretskii
2022-10-30 11:06         ` tomas
2022-10-30 11:19           ` Eli Zaretskii
2022-10-30 12:50 ` Stefan Monnier
2022-10-30 13:48   ` Gerd Möllmann
2022-10-30 14:25     ` Stefan Monnier
2022-10-31  6:31       ` Gerd Möllmann
2022-10-30 20:16 ` Helmut Eller
2022-10-31  6:27   ` Gerd Möllmann
2022-10-31 12:13     ` Juanma Barranquero
2022-10-31 12:57       ` Gerd Möllmann
2022-10-31 13:38         ` Juanma Barranquero
2022-10-31 19:53         ` Stefan Monnier
2022-11-11  4:35         ` Richard Stallman
2022-11-11  9:33           ` Gerd Möllmann
2022-11-13  4:17             ` Richard Stallman
2022-11-13  6:41               ` Gerd Möllmann
2022-11-03  3:17     ` Richard Stallman
2022-11-03  8:12       ` Michael Albinus
2022-11-03  3:17     ` Richard Stallman
2022-11-03  5:33       ` Gerd Möllmann
2022-11-03  3:17     ` Richard Stallman
2022-11-03  8:46       ` Eli Zaretskii
2022-11-05 16:49         ` Richard Stallman
2022-11-05 17:04           ` Eli Zaretskii
2022-11-07  7:47             ` Richard Stallman
2022-11-07 12:52               ` Eli Zaretskii
2022-11-08  6:19               ` Gerd Möllmann
2022-11-08  9:54                 ` João Távora
2022-11-08 10:35                   ` Gerd Möllmann
2022-11-08 15:40                     ` João Távora
2022-11-08 15:47                     ` Stefan Kangas
2022-11-08 22:43                       ` João Távora
2022-11-09  6:57                         ` Gerd Möllmann
2022-11-09  7:23                       ` Gerd Möllmann
2022-11-11  4:34                     ` Richard Stallman
2022-11-11  9:25                       ` Gerd Möllmann
2022-11-12  3:35                         ` Richard Stallman
2022-11-19 22:51                           ` [External] : " Drew Adams
2022-11-20  7:18                             ` Eli Zaretskii
2022-11-20 18:55                               ` [External] : " Drew Adams
2022-11-20 19:02                                 ` Eli Zaretskii
2022-11-22 12:14                                 ` [External] : " Richard Stallman
2022-11-22 14:22                                   ` Eli Zaretskii
2022-11-20  8:08                             ` Gerd Möllmann
2022-11-12  3:35                         ` Richard Stallman
2022-11-22 19:37                         ` Matt Armstrong [this message]
2022-11-23  7:33                           ` Juanma Barranquero
2022-11-26 23:32                             ` Richard Stallman
2022-11-27  9:05                               ` Juanma Barranquero
2022-11-30 23:55                                 ` Richard Stallman
2022-11-23  7:42                           ` Gerd Möllmann
2022-12-14 22:21                             ` Richard Stallman
2022-12-15  6:47                               ` Eli Zaretskii
2022-12-17 14:53                                 ` Richard Stallman
2022-11-22 18:01                       ` Matt Armstrong
2022-11-22 18:44                         ` Eli Zaretskii
2022-11-23  0:55                           ` Matt Armstrong
2022-11-23  7:49                             ` Gerd Möllmann
2022-11-23 12:18                             ` Eli Zaretskii
2022-11-11  4:35                 ` Richard Stallman
2022-11-11  9:35                   ` Gerd Möllmann
2022-11-11 12:09                     ` João Távora
2022-11-11 13:01                       ` Gerd Möllmann
2022-11-11 14:23                         ` João Távora
2022-11-11 15:12                           ` Gerd Möllmann
2022-11-12  9:17                             ` João Távora
2022-11-12 13:00                               ` Gerd Möllmann
2022-11-12  3:35                     ` Richard Stallman
2022-11-05 21:47           ` Eduardo Ochs
2022-11-06  9:05           ` Michael Albinus
2022-11-06 11:19             ` João Távora
2022-11-11  4:35               ` Richard Stallman
2022-11-11 10:09                 ` João Távora
2022-11-12  3:35                   ` Richard Stallman
2022-11-12 10:11                     ` João Távora
2022-11-12 14:36                       ` Dmitry Gutov
2022-11-12 15:20                         ` João Távora
2022-11-12 17:32                           ` Dmitry Gutov
2022-11-12 18:45                             ` João Távora
2022-11-14  1:03                               ` Dmitry Gutov
2022-11-14  6:33                                 ` João Távora
2022-11-14 11:41                                   ` Dmitry Gutov
2022-11-14 13:41                                     ` João Távora
2022-11-14  3:13                             ` Richard Stallman
2022-11-11  4:35             ` Richard Stallman
2022-11-11  8:53               ` Michael Albinus
2022-11-11  4:35   ` Richard Stallman
2022-11-11  7:10     ` Helmut Eller
2022-11-01  3:11 ` Ag Ibragimov
2022-11-02 20:11 ` João Távora
2022-11-03  5:12   ` Gerd Möllmann
2022-11-03 20:04     ` A short defense of shorthands.el (but CL packages are still better) (Was: Help sought understanding shorthands wrt modules/packages) João Távora
2022-11-04  3:28       ` Richard Stallman
2022-11-05  1:09         ` A short defense of shorthands.el (but CL packages are still better) João Távora
2022-11-07  7:44           ` Richard Stallman
2022-11-07 10:18             ` João Távora
2022-11-08  5:02               ` Richard Stallman
2022-11-08  5:18                 ` João Távora
2022-11-05  3:13     ` Help sought understanding shorthands wrt modules/packages Richard Stallman
2022-11-06 11:31       ` João Távora
2022-11-08  0:27         ` Matt Armstrong
2022-11-08  4:52           ` João Távora
2022-11-08  5:34             ` Gerd Möllmann
2022-11-09  4:03           ` Richard Stallman
2022-11-09  5:13             ` Matt Armstrong
2022-11-09  4:03           ` Richard Stallman
2022-11-09  5:42             ` Yuri Khan
2022-11-09  5:48               ` tomas
2022-11-09  6:02             ` Matt Armstrong
2022-11-09  7:15               ` Juanma Barranquero
2022-11-09  8:34               ` Gerd Möllmann
2022-11-09 10:07             ` Helmut Eller
2022-11-09 18:22               ` Matt Armstrong
  -- strict thread matches above, loose matches on Subject: below --
2022-11-07 21:20 Payas Relekar
2022-11-08  9:40 ` João Távora

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871qpubx1p.fsf@rfc20.org \
    --to=matt@rfc20.org \
    --cc=emacs-devel@gnu.org \
    --cc=gerd.moellmann@gmail.com \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).