unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Michał \"phoe\" Herda" <phoe@disroot.org>
To: emacs-devel@gnu.org
Subject: Why :USE sucks in the Common Lisp package system
Date: Sat, 9 May 2020 22:34:10 +0200	[thread overview]
Message-ID: <e98130de-bd5e-0f08-1820-9ca4bcec76bd@disroot.org> (raw)
In-Reply-To: <xjf5zd5j65g.fsf@sdf.org>

On 09.05.2020 20:48, Andrea Corallo wrote:
> I'm *not* sure we should and I'm not stating that now.  I suspect it
> would be worth, but we are really in early discussion and investigation.

Hey,

just noticed that one of my posts was mentioned here earlier; I thought
that I could provide a bit more context from the perspective of a Common
Lisp programmer, especially in the context of the namespacing discussion
for elisp.

In CL, we have packages that can :USE each other, and we have had them
ever since Common Lisp had become standardized. Recently (and I mean,
like, very recently - two, three years?), the support for a language
extension called package-local nicknames has emerged, mostly to resolve
the growing issue of global nicknames polluting global namespaces: BT
stood for Binary Types, but BT also stood for Bordeaux Threads, but BT
also stood for... And so on, and so on. This, however, has given the CL
community to work with one more issue in the CL ecosystem, which is :USE
abuse.

The major issue with :USE is its ubiquity - packages :USE literally
everything, a lot of other packages, even (and especially) code that
they have no control over. This means that they now depend on these
packages' exports not interfering with their code. Who can guarantee
that? No one, really, unless some manual or automated inspection of
packages is done.

This has led to de-facto ossification of some libraries upon which lots
of code depends, the most famous example being Alexandria, the most
popular CL library. If everyone uses Alexandria along with 20 or so
other packages, then if Alexandria introduces a new exported symbol,
then it may either generate package conflicts with other used packages
(this visibly breaks code) or its value/function/class/whatever cells
may be silently overwritten by a package that previously used to have
its own symbol with that name but now inherits it from Alexandria (which
*invisibly* breaks code).

I bet that a massive amount of Common Lisp code is written that way,
simply because PLNs did not even exist back when that code was written.
Previously, it was cumbersome to manually write (alexandria:assoc-value
...), so people resorted to :USE; nowadays, with PLNs, it is much easier
to write (a:assoc-value ...), and :USE is not required to write readable
code.

My point of view is that the package system with PLNs is good enough for
my use cases: I can :USE the COMMON-LISP package or perhaps one of its
replacements, such as COMMON-LISP+QT, and locally nickname all libraries
I use.

I hope that, at one point (meaning: when the CLISP implementation gets
package-local nicknames implemented), we will be able to go through all
of the code in Quicklisp and adjust it to reduce the :USE abuse, and
therefore free existing libraries from this unfortunate ossification.
It's a non-trivial amount of work to do, but I hope it'll be done.

While I'm no emacs programmer (this is my first post here!), I think
that a package system with PLNs could work for elisp as a tool for
symbol namespacing, as long as it is clear that elisp programmers know
not to repeat the mistake from the CL ecosystem and only use :USE for
packages that either do not change (in our case, it's the COMMON-LISP
package), or a package that changes but is the only used package (and
therefore has nothing to conflict with), or a combination of packages
that do not change and we have full control over so we can manually see
and resolve the symbol conflicts as they arise. And then, we locally
nickname everything, e.g. importing ALEXANDRIA as A, FLEXI-STREAMS as F,
BORDEAUX-THREADS as BT or just T, and write our code that way.

BR
Michał "phoe" Herda




  reply	other threads:[~2020-05-09 20:34 UTC|newest]

Thread overview: 101+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-04 10:52 Proper namespaces in Elisp João Távora
2020-05-04 15:11 ` Adam Porter
2020-05-04 15:38   ` Clément Pit-Claudel
2020-05-04 15:49     ` João Távora
2020-05-04 16:39       ` Adam Porter
2020-05-04 16:49         ` João Távora
2020-05-04 18:00       ` Clément Pit-Claudel
2020-05-04 20:19       ` Vladimir Sedach
2020-05-05  2:51     ` Richard Stallman
2020-05-04 15:29 ` Clément Pit-Claudel
2020-05-04 16:04   ` João Távora
2020-05-04 18:29     ` Helmut Eller
2020-05-04 18:39     ` Stefan Monnier
2020-05-04 19:02       ` João Távora
2020-05-04 19:20         ` Stefan Monnier
2020-05-04 19:49           ` João Távora
2020-05-04 21:59         ` Andrea Corallo
2020-05-04 22:34           ` João Távora
2020-05-05 10:33             ` Andrea Corallo
2020-05-05 10:54               ` Andrea Corallo
2020-05-05 12:50               ` João Távora
2020-05-05 13:34                 ` Andrea Corallo
2020-05-05 14:03                   ` João Távora
2020-05-05 14:26                     ` Andrea Corallo
2020-05-05 21:20                       ` João Távora
2020-05-05 23:37                         ` Andrea Corallo
2020-05-06  0:15                           ` João Távora
2020-05-06  7:07                             ` Andrea Corallo
2020-05-06 19:48                               ` João Távora
2020-05-07  6:13                                 ` Andrea Corallo
2020-05-05 13:45               ` Stefan Monnier
2020-05-05 14:07                 ` João Távora
2020-05-05  4:55           ` Helmut Eller
2020-05-04 21:40     ` Vladimir Sedach
2020-05-04 22:09       ` João Távora
2020-05-05  1:09         ` Vladimir Sedach
2020-05-05  9:38           ` João Távora
2020-05-05 16:41             ` Vladimir Sedach
2020-05-05 21:29               ` João Távora
2020-05-06  3:25                 ` Vladimir Sedach
2020-05-06 19:38                   ` João Távora
2020-05-06 22:47                     ` Vladimir Sedach
2020-05-07 10:00                       ` João Távora
2020-05-07 18:30                         ` Vladimir Sedach
2020-05-07 19:32                           ` João Távora
2020-05-04 22:40       ` João Távora
2020-05-05  1:24         ` Vladimir Sedach
2020-05-04 15:43 ` Stefan Monnier
2020-05-05 15:10 ` Tom Tromey
2020-05-05 21:30   ` João Távora
2020-05-07  2:23     ` Tom Tromey
2020-05-07  3:12       ` Stefan Monnier
2020-05-07 13:02         ` Tom Tromey
2020-05-07 13:48           ` João Távora
2020-05-07 18:17             ` Stefan Monnier
2020-05-07 18:48               ` Vladimir Sedach
2020-05-07 20:33                 ` João Távora
2020-05-08  2:56                   ` Vladimir Sedach
2020-05-08 15:56                     ` João Távora
2020-05-08 17:59                       ` Vladimir Sedach
2020-05-08 18:38                         ` João Távora
2020-05-07 19:37         ` Daniel Colascione
2020-05-07 20:28           ` Stefan Monnier
2020-05-07 20:42             ` Daniel Colascione
2020-05-07 21:06               ` Stefan Monnier
2020-05-07 21:10                 ` Daniel Colascione
2020-05-07 21:46                   ` João Távora
2020-05-07 21:56                     ` Daniel Colascione
2020-05-07 22:12                       ` João Távora
2020-05-08 18:59               ` Vladimir Sedach
2020-05-08 19:34                 ` Daniel Colascione
2020-05-09  0:00                   ` Vladimir Sedach
2020-05-09  0:32                     ` Daniel Colascione
2020-05-09  8:37                       ` Andrea Corallo
2020-05-09 16:11                         ` Daniel Colascione
2020-05-09 17:25                           ` Andrea Corallo
2020-05-09 17:45                             ` Daniel Colascione
2020-05-09 18:23                               ` João Távora
2020-05-09 18:32                                 ` Daniel Colascione
2020-05-09 18:35                                   ` João Távora
2020-05-09 18:39                                     ` Daniel Colascione
2020-05-09 19:11                                       ` João Távora
2020-05-09 18:30                               ` Andrea Corallo
2020-05-09 18:33                                 ` Daniel Colascione
2020-05-09 18:48                                   ` Andrea Corallo
2020-05-09 20:34                                     ` Michał "phoe" Herda [this message]
2020-05-09 21:47                                       ` Why :USE sucks in the Common Lisp package system João Távora
2020-05-09 21:55                                         ` Michał "phoe" Herda
2020-05-09 22:01                                           ` Daniel Colascione
2020-05-09 22:07                                             ` Michał "phoe" Herda
2020-05-09 22:12                                           ` João Távora
2020-05-10 10:10                                             ` Michał "phoe" Herda
2020-05-09 23:23                                       ` Andrea Corallo
2020-05-10  6:46                                         ` Andreas Schwab
2020-05-10  8:53                                           ` Helmut Eller
2020-05-10  9:59                                             ` Michał "phoe" Herda
2020-05-10  1:19                       ` Proper namespaces in Elisp Vladimir Sedach
2020-05-08 23:07                 ` Andrea Corallo
2020-05-08 23:23                   ` Stefan Monnier
2020-05-09  8:12                     ` Andrea Corallo
2020-05-09 12:06             ` Tuấn-Anh Nguyễn

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=e98130de-bd5e-0f08-1820-9ca4bcec76bd@disroot.org \
    --to=phoe@disroot.org \
    --cc=emacs-devel@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).