From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: =?UTF-8?Q?Micha=c5=82_=22phoe=22_Herda?= Newsgroups: gmane.emacs.devel Subject: Why :USE sucks in the Common Lisp package system Date: Sat, 9 May 2020 22:34:10 +0200 Message-ID: References: <87ftcee7td.fsf@tromey.com> <87pnbgzdmx.fsf@tromey.com> <1225997b-648a-068d-7f6b-e1575477a0d0@dancol.org> <875zd62qy7.fsf@t510.orion.oneofus.la> <09ed390e-c735-3a7e-ecfd-504557b192a2@dancol.org> <87368a2d1a.fsf@t510.orion.oneofus.la> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="39818"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat May 09 22:34:50 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jXWBN-000ACx-6a for ged-emacs-devel@m.gmane-mx.org; Sat, 09 May 2020 22:34:49 +0200 Original-Received: from localhost ([::1]:56792 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jXWBM-0005ry-9l for ged-emacs-devel@m.gmane-mx.org; Sat, 09 May 2020 16:34:48 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56640) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jXWAs-0005TG-NI for emacs-devel@gnu.org; Sat, 09 May 2020 16:34:18 -0400 Original-Received: from knopi.disroot.org ([178.21.23.139]:53592) by eggs.gnu.org with esmtps (TLS1.2:DHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1jXWAq-0002FI-Sj for emacs-devel@gnu.org; Sat, 09 May 2020 16:34:18 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id D4DF82B411 for ; Sat, 9 May 2020 22:34:12 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at disroot.org Original-Received: from knopi.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fTNnL-pL85kT for ; Sat, 9 May 2020 22:34:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1589056451; bh=U+/yzQeOC/G0705TNvQRxFysDDfqWw9YrvIK3ZN7s+4=; h=Subject:To:References:From:Date:In-Reply-To; b=Fvao69ZOuQFLfN8maV0bbUaHuS/MDocTLwH9u1z/Dpk2V7IHg41RWoNISz/lgAeLX 6/wNPNkEQXnH1q5xrfSSSKEP9PI69EuEr19xefcF72tkmBMfH4CD1QWNp7Bff+gAhF s7rsb8ec7kOPNvD4oUZXqB9lUL8OEL2TxPlf+72vYzdoVG/EjKQ6dGvY5EIoP+c9xZ pdGrHdbFa6TZpNTcaUrgAUqdxvpvfZNKV02XiZnFQdNt/q3J2fjBjHf4O6JnwgxLq4 K6Bg4l2chjDcgPdJqJd/osbE/zlqRSxtICeAzEz5YDHk9gBavvfADfdjYGGM0gheF/ 7/feDAe5BA3VQ== Autocrypt: addr=phoe@disroot.org; keydata= mQGNBFo+0HQBDAC2cT8vftmYYq/Qnl35kjF7N2jfbjq8h5LbAhyS+2noMQUVEMUBwUHsfHq2 D1FzY8DSt3ekEwOJtQY46QocVVUGm4wokkanN+leSGKSgumOnCpo5drkVBB8qaMqOcO9A1Ty e95laUnSIJBkhJ0chUTzDdBm29hBfkDQxwHviB3QIZjxllHXVLJTBseeWQGVyCrLhLDOJzYi ceKqJe92wBNTmZ3yXwIXmwG5owVm+m0DiVkSYJLiN7MfPuQqfBIdnRWdrc+JDGWEqb3aC+mE 1sCaD30/QFGHQ8X+NCoP96KlZz6dXxvqb0vZSIXOkPdcCLZ/e0GNSL3wYpNAhzWA7+vdQKqv xB2ZEeOmJRJboI45XZn5rr73rqrHdYgif3dtrfYuMYaX0BO9k0YUnJNjvqqieGiQHo/8sdMR DG12yDXnktMDMVmVkGeQQzGnVx6vmdffoEnNLVH2Rbi20uyQMvj71Td2oCO6oBIipHZ2Ht/P OfO2UIUsneBs+gfu0+n7WLkAEQEAAbQlTWljaGHFgiAicGhvZSIgSGVyZGEgPHBob2VAdGVr bmlrLmlvPokBzgQTAQoAOBYhBAHAbWLNZXvsD6EbIb58DGqH3tV8BQJaPtB0AhsDBQsJCAcC BhUKCQgLAgQWAgMBAh4BAheAAAoJEL58DGqH3tV8htEMAILK+ToE4eHsIa/mgeZaem/bqBl5 bfp6Mw2aGDJkpoH396+oCNIqy25rrNKbCsYH4RfFcHOuy/uIki8vIrPkiC25+6t4EuefkWGw WZkK+XWnmOq3WUqW0oTWPrr51spy7eubqY2lZZf4sO In-Reply-To: Content-Language: en-US Received-SPF: pass client-ip=178.21.23.139; envelope-from=phoe@disroot.org; helo=knopi.disroot.org X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/09 16:34:13 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:249577 Archived-At: 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