package local nicknames
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 PACKAGE-LOCALLY-NICKNAMED-BY 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)}*)
:PACKAGE-LOCAL-NICKNAMES in *FEATURES*
Design issues and considerations:
* "CL", "COMMON-LISP", and "KEYWORD" signal a continuable error
when 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, but built on top of
FIND-PACKAGE-USING-PACKAGE -- undocumented and unexported, but
waiting to be turned into something interesting by Christophe.
* 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.