X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=doc%2Fmanual%2Fbeyond-ansi.texinfo;h=348208c9097de1f4e3d06ae92e77071866dc008c;hb=6129b1ebc5125c57d6446c061155f5f653f41725;hp=221ebc5e7f57f5dddbc4a049799aa0dcf83cdbe0;hpb=af1b968cdcfac5a93ed828be46349dfd4f764f93;p=sbcl.git diff --git a/doc/manual/beyond-ansi.texinfo b/doc/manual/beyond-ansi.texinfo index 221ebc5..348208c 100644 --- a/doc/manual/beyond-ansi.texinfo +++ b/doc/manual/beyond-ansi.texinfo @@ -7,18 +7,19 @@ ANSI standard. SBCL doesn't support as many extensions as CMUCL, but it still has quite a few. @xref{Contributed Modules}. @menu -* Reader Extensions:: -* Garbage Collection:: -* Metaobject Protocol:: -* Support For Unix:: -* Customization Hooks for Users:: -* Tools To Help Developers:: -* Resolution of Name Conflicts:: -* Hash Table Extensions:: -* Random Number Generation:: -* Miscellaneous Extensions:: -* Stale Extensions:: -* Efficiency Hacks:: +* Reader Extensions:: +* Package-Local Nicknames:: +* Garbage Collection:: +* Metaobject Protocol:: +* Support For Unix:: +* Customization Hooks for Users:: +* Tools To Help Developers:: +* Resolution of Name Conflicts:: +* Hash Table Extensions:: +* Random Number Generation:: +* Miscellaneous Extensions:: +* Stale Extensions:: +* Efficiency Hacks:: @end menu @node Reader Extensions @@ -43,6 +44,69 @@ Example: Doesn't alter @code{*package*}: if @code{foo::bar} would cause a read-time package lock violation, so does @code{foo::(bar)}. +@node Package-Local Nicknames +@comment node-name, next, previous, up +@section Package-Local Nicknames +@cindex Package-Local Nicknames + +SBCL allows giving packages local nicknames: they allow short and +easy-to-use names to be used without fear of name conflict associated +with normal nicknames. + +A local nickname is valid only when inside the package for which it +has been specified. Different packages can use same local nickname for +different global names, or different local nickname for same global +name. + +Symbol @code{:package-local-nicknames} in @code{*features*} denotes the +support for this feature. + +@findex @cl{defpackage} +@defmac @cl{defpackage} name [[option]]* @result{} package + +Options are extended to include + +@itemize +@item +@code{:local-nicknames} @var{(local-nickname actual-package-name)}* + +The package has the specified local nicknames for the corresponding +actual packages. +@end itemize + +Example: + +@lisp +(defpackage :bar (:intern "X")) +(defpackage :foo (:intern "X")) +(defpackage :quux (:use :cl) (:local-nicknames (:bar :foo) (:foo :bar))) +(find-symbol "X" :foo) ; => FOO::X +(find-symbol "X" :bar) ; => BAR::X +(let ((*package* (find-package :quux))) + (find-symbol "X" :foo)) ; => BAR::X +(let ((*package* (find-package :quux))) + (find-symbol "X" :bar)) ; => FOO::X +@end lisp +@end defmac + +@include fun-sb-ext-package-local-nicknames.texinfo +@include fun-sb-ext-package-locally-nicknamed-by.texinfo +@include fun-sb-ext-add-package-local-nickname.texinfo +@include fun-sb-ext-remove-package-local-nickname.texinfo + +@node Package Variance +@comment node-name, next, previous, up +@section Package Variance + +Common Lisp standard specifies that ``If the new definition is at +variance with the current state of that package, the consequences are +undefined;'' SBCL by default signals a full warning and retains as +much of the package state as possible. + +This can be adjusted using @code{sb-ext:*on-package-variance*}: + +@include var-sb-ext-star-on-package-variance-star.texinfo + @node Garbage Collection @comment node-name, next, previous, up @section Garbage Collection @@ -290,7 +354,7 @@ between classes and proper names and between lists of the form @vindex @sbpcl{+slot-unbound+} @findex @sbmop{standard-instance-access} @findex @sbmop{funcallable-standard-instance-access} -distinguising unbound instance allocated slots from bound ones when +distinguishing unbound instance allocated slots from bound ones when using @code{standard-instance-access} and @code{funcallable-standard-instance-access} is possible by comparison to the constant @code{+slot-unbound+}. @@ -302,9 +366,9 @@ to the constant @code{+slot-unbound+}. @section Support For Unix @menu -* Command-line arguments:: -* Querying the process environment:: -* Running external programs:: +* Command-line arguments:: +* Querying the process environment:: +* Running external programs:: @end menu @node Command-line arguments