emacs.d/clones/lisp/www.cs.cmu.edu/Groups/AI/html/cltl/clm/node112.html

66 lines
3.7 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.1. Consistency Rules</TITLE>
</HEAD>
<BODY>
<meta name="description" value=" Consistency Rules">
<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=tex2html2923 HREF="node113.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html2921 HREF="node111.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html2915 HREF="node111.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html2925 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html2926 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME=tex2html2924 HREF="node113.html"> Package Names</A>
<B>Up:</B> <A NAME=tex2html2922 HREF="node111.html"> Packages</A>
<B> Previous:</B> <A NAME=tex2html2916 HREF="node111.html"> Packages</A>
<HR> <P>
<H1><A NAME=SECTION001510000000000000000>11.1. Consistency Rules</A></H1>
<P>
Package-related bugs can be very subtle and confusing: things are not
what they appear to be. The Common Lisp package system is designed with
a number of safety features to prevent most of the common bugs that
would otherwise occur in normal use. This may seem over-protective, but
experience with earlier package systems has shown that such safety
features are needed.
<P>
In dealing with the package system, it is useful to keep in mind the
following consistency rules, which remain in force as long as the value
of <tt>*package*</tt> is not changed by the user:
<P>
<UL><LI>
<i>Read-read consistency:</i> Reading the same print name always results in
the same (<tt>eq</tt>) symbol.
<P>
<LI>
<i>Print-read consistency:</i> An interned symbol always prints as a
sequence of characters that, when read back in, yields the same (<tt>eq</tt>)
symbol.
<P>
<LI>
<i>Print-print consistency:</i> If two interned symbols are not <tt>eq</tt>, then
their printed representations will be different sequences of
characters.
</UL>
<P>
These consistency rules remain true in spite of any amount of implicit
interning caused by typing in Lisp forms, loading files, etc. This has
the important implication that, as long as the current package
is not changed, results are reproducible regardless of
the order of loading files or the exact history of what symbols were
typed in when. The rules can only be violated by explicit action:
changing the value of <tt>*package*</tt>, forcing some action by continuing
from an error, or calling one of the ``dangerous'' functions
<tt>unintern</tt>, <tt>unexport</tt>, <tt>shadow</tt>,
<tt>shadowing-import</tt>, or <tt>unuse-package</tt>.
<P>
<BR> <HR><A NAME=tex2html2923 HREF="node113.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html2921 HREF="node111.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html2915 HREF="node111.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html2925 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html2926 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME=tex2html2924 HREF="node113.html"> Package Names</A>
<B>Up:</B> <A NAME=tex2html2922 HREF="node111.html"> Packages</A>
<B> Previous:</B> <A NAME=tex2html2916 HREF="node111.html"> Packages</A>
<HR> <P>
<HR>
<P><ADDRESS>
AI.Repository@cs.cmu.edu
</ADDRESS>
</BODY>