98 lines
5.9 KiB
HTML
98 lines
5.9 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN">
|
|
<!Converted with LaTeX2HTML 0.6.5 (Tue Nov 15 1994) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds >
|
|
<HEAD>
|
|
<TITLE>11.2. Package Names</TITLE>
|
|
</HEAD>
|
|
<BODY>
|
|
<meta name="description" value=" Package Names">
|
|
<meta name="keywords" value="clm">
|
|
<meta name="resource-type" value="document">
|
|
<meta name="distribution" value="global">
|
|
<P>
|
|
<b>Common Lisp the Language, 2nd Edition</b>
|
|
<BR> <HR><A NAME=tex2html2935 HREF="node114.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html2933 HREF="node111.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html2927 HREF="node112.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html2937 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html2938 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
|
|
<B> Next:</B> <A NAME=tex2html2936 HREF="node114.html"> Translating Strings to </A>
|
|
<B>Up:</B> <A NAME=tex2html2934 HREF="node111.html"> Packages</A>
|
|
<B> Previous:</B> <A NAME=tex2html2928 HREF="node112.html"> Consistency Rules</A>
|
|
<HR> <P>
|
|
<H1><A NAME=SECTION001520000000000000000>11.2. Package Names</A></H1>
|
|
<P>
|
|
<A NAME=PACKAGENAMESSECTION>Each</A>
|
|
package has a name (a string) and perhaps some nicknames. These
|
|
are assigned when the package is created, though they can be changed
|
|
later. A package's name should be something long and self-explanatory,
|
|
like <tt>editor</tt>; there might be a nickname that is shorter and easier to
|
|
type, such as <tt>ed</tt>.
|
|
<P>
|
|
There is a single name space for packages. The function
|
|
<tt>find-package</tt> translates a package name or nickname into the
|
|
associated package. The function <tt>package-name</tt> returns the name of a
|
|
package. The function <tt>package-nicknames</tt> returns a list of all
|
|
nicknames for a package. The function <tt>rename-package</tt> removes a
|
|
package's current name and nicknames and replaces them with new ones
|
|
specified by the user. Package renaming is occasionally useful when, for
|
|
development purposes, it is desirable to load two versions of a package
|
|
into the same Lisp. One can load the first version, rename it,
|
|
and then load the other version, without getting a lot of name conflicts.
|
|
<P>
|
|
When the Lisp reader sees a qualified symbol, it handles the package-name
|
|
part in the same way as the symbol part with respect to capitalization.
|
|
Lowercase characters in the package name are converted to corresponding
|
|
uppercase characters
|
|
unless preceded by the escape character <tt> </tt> or
|
|
surrounded by <tt>|</tt> characters. The lookup done by the
|
|
<tt>find-package</tt> function is case-sensitive, like that done for
|
|
symbols. Note that <tt>|Foo|:|Bar|</tt> refers to a symbol whose name is
|
|
<tt>Bar</tt> in a package whose name is <tt>Foo</tt>. By contrast,
|
|
<tt>|Foo:Bar|</tt> refers to a seven-character symbol that has a colon in its name
|
|
(as well as two uppercase letters and four lowercase letters)
|
|
and is interned in the current package. Following the convention used
|
|
in this book for symbols, we show ordinary package names using
|
|
lowercase letters, even though the name string is internally represented
|
|
with uppercase letters.
|
|
<P>
|
|
Most of the functions that require a package-name argument from the
|
|
user accept either a symbol or a string. If a symbol is supplied,
|
|
its print name will be used; the print name will already have undergone
|
|
case-conversion by the usual rules. If a string is supplied, it
|
|
must be so capitalized as to match exactly the
|
|
string that names the package.
|
|
<P>
|
|
<img align=bottom alt="change_begin" src="gif/change_begin.gif"><br>
|
|
X3J13 voted in January 1989
|
|
(PACKAGE-FUNCTION-CONSISTENCY) <A NAME=10191> </A>
|
|
to clarify that one may use either a package object or
|
|
a package name (symbol or string) in any of the following
|
|
situations:
|
|
<UL><LI> the <tt>:use</tt> argument to <tt>make-package</tt><p>
|
|
<LI> the first argument to <tt>package-use-list</tt>, <tt>package-used-by-list</tt>,
|
|
<tt>package-name</tt>, <tt>package-nicknames</tt>,
|
|
<tt>in-package</tt>, <tt>find-package</tt>,
|
|
<tt>rename-package</tt>, or <tt>delete-package</tt>,
|
|
<P>
|
|
<LI> the second argument to <tt>intern</tt>, <tt>find-symbol</tt>,
|
|
<tt>unintern</tt>, <tt>export</tt>, <tt>unexport</tt>, <tt>import</tt>, <tt>shadowing-import</tt>,
|
|
or <tt>shadow</tt><p>
|
|
<LI> the first argument, or a member of the list that is the first argument,
|
|
to <tt>use-package</tt> or <tt>unuse-package</tt><p>
|
|
<LI> the value of the <i>package</i> given to <tt>do-symbols</tt>,
|
|
<tt>do-external-symbols</tt>, or <tt>do-all-symbols</tt><p>
|
|
<LI> a member of the <i>package-list</i> given to <tt>with-package-iterator</tt>
|
|
</UL>
|
|
Note that the first argument to <tt>make-package</tt> must still be a package
|
|
name and not an actual package; it makes no sense to create an already
|
|
existing package. Similarly, package nicknames must always be expressed
|
|
as package names and not as package objects. If <tt>find-package</tt> is
|
|
given a package object instead of a name, it simply returns that package.
|
|
<br><img align=bottom alt="change_end" src="gif/change_end.gif">
|
|
<P>
|
|
<BR> <HR><A NAME=tex2html2935 HREF="node114.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html2933 HREF="node111.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html2927 HREF="node112.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html2937 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html2938 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
|
|
<B> Next:</B> <A NAME=tex2html2936 HREF="node114.html"> Translating Strings to </A>
|
|
<B>Up:</B> <A NAME=tex2html2934 HREF="node111.html"> Packages</A>
|
|
<B> Previous:</B> <A NAME=tex2html2928 HREF="node112.html"> Consistency Rules</A>
|
|
<HR> <P>
|
|
<HR>
|
|
<P><ADDRESS>
|
|
AI.Repository@cs.cmu.edu
|
|
</ADDRESS>
|
|
</BODY>
|