all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Gerd Möllmann" <gerd.moellmann@gmail.com>
To: Richard Stallman <rms@gnu.org>
Cc: relekarpayas@gmail.com,  emacs-devel@gnu.org
Subject: Re: No to CL packages
Date: Sat, 29 Oct 2022 07:18:09 +0200	[thread overview]
Message-ID: <m27d0jus1a.fsf@Mini.fritz.box> (raw)
In-Reply-To: <E1ooXO0-0007hq-AR@fencepost.gnu.org> (Richard Stallman's message of "Fri, 28 Oct 2022 17:59:32 -0400")

[-- Attachment #1: Type: text/plain, Size: 3386 bytes --]

Richard Stallman <rms@gnu.org> 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. ]]]
>
>   > I see no need to invent yet another package system.
>
> We already have it, not quite finished.

That it's not yet finished is why I asked if there is a design that I
can read.  Because, from what is there, I can't figure out how it
replaces familiar package systems.

Familiar not in the sense of being familiar with CL, but more generally,
because what Python and many other languages do is at least similar, if
not inspired by what CL does.

>   > > With that, we will be able to implement packages that work reliably
>   > > and without ambiguities.
>
>   > You mention reliability and ambiguity.  What do you mean, in a concrete
>   > example?
>
> I can't write an example of Common Liso packages -- it was 40 years
> ago that I implemented them for the Lisp Machine.  But I recall what
> the unreliability was.  With CL packages, the reader searched a list
> of packages (specified by the current package) for a symbol with the
> name just read.  This means that the unexpected presence of a symbol
> with that name, in an early package in the list, could alter the
> meaning.
>
> If the list includes packages foo abd bar, and you write `my-hack'
> expecting the symbol to be found in bar, but unexpectedly foo contains
> a symbol named my-hack, you will get that one.

That's no longer a problem in CL, you'll get an error.  This is how it
looks in GNU/CLisp:

;; Create two packages names "FOO" and "BAR"
[1]> (defvar foo (make-package "FOO"))
[2]> (defvar bar (make-package "BAR"))

;; Make symbols "MY-HACK" in foo and bar and export them
[3]> (intern "MY-HACK" foo)
[4]> (intern "MY-HACK" bar)
[5]> (export 'foo::my-hack foo)
[6]> (export 'bar::my-hack bar)

;; Use (inherit from) package foo in the current package
;;   (common-lisp-user).
[7]> (use-package foo)
[8]> (find-symbol "MY-HACK")
MY-HACK ;
:INHERITED

;; Try to use bar
[9]> (use-package bar)

*** - (USE-PACKAGE (#<PACKAGE BAR>) #<PACKAGE COMMON-LISP-USER>): 1 name conflicts remain
      Which symbol with name "MY-HACK" should be accessible in #<PACKAGE COMMON-LISP-USER>?
The following restarts are available:
BAR            :R1      #<PACKAGE BAR>
COMMON-LISP-USER :R2    #<PACKAGE COMMON-LISP-USER>
ABORT          :R3      Abort main loop
Break 1 [14]> 

As a general principle in the CL package system, at most one symbol with
a given name is accessible in a package at any time.

>   > In case you're thinking in terms of the pre-CL package system that some
>   > Lisp machines had in the 80s, please read chapter 11 of "Common Lisp the
>   > Language 2nd edition" by Guy Steele.  CL's package system is not like
>   > the older one.
>
> I implemented packages according to the CL specifications.  Perhaps
> the specifications for packages have been changed since then.  I'm
> willing to look at that.

Thanks.

> Being hundreds of messages backlogged from the past 10 days, I'd
> rather not try to download the whole CL specs and search through them.
> Would you please email me that specific chapter?

Attaches as PDF.  If that's not working for you, I could also get the
LaTeX sources, if you want, but they are a bit hard to read.


[-- Attachment #2: CLtL2 chapter 11 --]
[-- Type: application/pdf, Size: 919945 bytes --]

      reply	other threads:[~2022-10-29  5:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-21 15:24 [External] : CL packages landed Payas Relekar
2022-10-21 20:13 ` Drew Adams
2022-10-23 19:11   ` No to CL packages Richard Stallman
2022-10-24  4:40     ` Gerd Möllmann
2022-10-28 21:59       ` Richard Stallman
2022-10-29  5:18         ` Gerd Möllmann [this message]

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

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

  git send-email \
    --in-reply-to=m27d0jus1a.fsf@Mini.fritz.box \
    --to=gerd.moellmann@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=relekarpayas@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.