On Sat, 6 Jul 2024 18:56:15 +0200, Alexander Fedorov said:
Dear all,
Over 10 years ago, SBCL implemented the Package-Local Nicknames (PLNs) extension. Since then, PLNs have also been adopted by multiple implementations (ABCL, CCL, ECL, Clasp, Allegro CL and LispWorks) and are now widely used in many projects.
However, PLNs are still considered experimental, as stated in the SBCL manual, since there is no formal specification for them, and each implementation interprets various corner cases differently. While the need for a specification has been previously discussed, I was unable to find any publicly accessible draft for one.
Therefore, I have drafted a specification intended to become a CDR document. I initially wrote this draft about a year ago and have recently revised it. You can find the latest version here: https://gleefre.github.io/cdr-package-local-nicknames/index.html.
There are currently nine unresolved standardization issues, each with at least one proposed resolution. Input on those issues would be particularly helpful, but any feedback is welcome!
P.S. I am sharing this link across multiple platforms to reach as many lispers as possible. This includes various mailing lists (Lisp Pro, CDR-discuss and -devel for various CL implementations); IRC channels (#commonlisp and implementation-specific ones); the Lisp Discord server; several Telegram groups; and a post on Reddit. If you have any suggestions for additional places to share the link, please let me know.
My apologies to those receiving this message multiple times.
Best regards, Alexander Fedorov.
Firstly, thanks for writing this up. I like the idea of having a specification for PLNs. Possibly it is inevitable at this stage that it is heavily based on the current implementations with minor cleanups, but it was never clear to me if the quirks in the SBCL implementation were deliberate or accidental.
Most of the issues you have identified only affect new APIs that use PLNs, but Issue 3 (Local nicknames effect on DEFPACKAGE, MAKE-PACKAGE and others) is a bigger problem IMHO because it affects other code by the accidental value of *PACKAGE*. I think the most pervasive part of this issue is actually IN-PACKAGE, not DEFPACKAGE or MAKE-PACKAGE, which is why LispWorks doesn't look up PLNs for IN-PACKAGE.
How about another proposal for issue 3: FIND-PACKAGE-AND-READ-PRINT-ONLY, meaning that only FIND-PACKAGE and the reader/printer are affected? To allow callers of the other package functions to detect PLNs, add an optional second argument "package" to FIND-PACKAGE, which would be used in the lookup of the first argument and would default to nil, meaning no PLN lookup.
That would allow code such as:
(intern name (find-package "FOO"))
to work without any ambiguity about what FOO means.