package local nicknames
authorNikodemus Siivola <nikodemus@random-state.net>
Tue, 22 Jan 2013 02:04:49 +0000 (04:04 +0200)
committerNikodemus Siivola <nikodemus@random-state.net>
Fri, 1 Feb 2013 16:22:39 +0000 (18:22 +0200)
commitb0b221088b889b6d3ae67e551b93fe1a6cfec878
treeb37effed9fc5569cf016ebfa4efbaa9160507b3b
parent52f174450abacd81963073b71af2ce7b62908178
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.
NEWS
base-target-features.lisp-expr
doc/manual/beyond-ansi.texinfo
doc/manual/package-locks-extended.texinfo
package-data-list.lisp-expr
src/code/defpackage.lisp
src/code/package.lisp
src/code/print.lisp
src/code/target-package.lisp
tests/packages.impure.lisp