-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Example terminal session using Linedit: * (defpackage :foo (:use :cl) (:local-nicknames (:sb :sb-ext))) #<PACKAGE "FOO"> * (in-package :foo) #<PACKAGE "FOO"> * (sb:posix- sb:posix-environ sb:posix-getenv * (sb:posix-getenv "USER") "nikodemus" API: function PACKAGE-LOCAL-NICKNAMES package function ADD-PACKAGE-LOCAL-NICKNAME nick global &optional package function REMOVE-PACKAGE-LOCAL-NICKNAME old-nick &optional package DEFPACKAGE option: (:local-nicknames {(local-nick global-name)}*) Design issues and considerations: * Nicknames are late-bound. This is seems good for usability and also keeps the implementation simple. Causes ugliness in printing, though. * "CL", "COMMON-LISP", "KEYWORD", and "" cannot be used as local nicknames. I think this is good for sanity, but not strictly required. Because of the way (find-package :keyword) is idiomatically used to guarantee print/read consistency across packages, I think it at least should be protected. * To preserve read/print consistency, we use package local nicknames as prefixes when printing. * The hook into FIND-PACKAGE is invisible. An alternative solution would be to add FIND-PACKAGE-USING-PACKAGE, but that would not work out of the box with arbitrary existing code: see for example how nicely Linedit was able to utilize the sb: prefix without any changes to it. * Local nicknames are protected by package locks. * If you want to bypass nicknames, you need to first get into a known package without nicknames. There could be an explicit way as well, but not sure if that's needed or a good idea. Random crap mixed in: Re-order DEFPACKAGE option docs in rough order of usefulness.
- Loading branch information
Showing
8 changed files
with
300 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
3c11847
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
3c11847
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you write a CDR so other implementations get the same feature in a portable way?
3c11847
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3c11847
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey,
ECL (and ABCL) supports the same API now[1], I'd love to see a CDR for this.
Regards,
Daniel
[1] https://gitlab.com/embeddable-common-lisp/ecl/commit/1ee24e8e3d33427b647d1f9862a035593257e80e