46 lines
14 KiB
HTML
46 lines
14 KiB
HTML
<!-- Common Lisp HyperSpec (TM), version 7.0 generated by Kent M. Pitman on Mon, 11-Apr-2005 2:31am EDT -->
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE>CLHS: Section 3.2.4.4</TITLE>
|
|
<LINK HREF="../Data/clhs.css" REL="stylesheet" TYPE="text/css" />
|
|
<META HTTP-EQUIV="Author" CONTENT="Kent M. Pitman">
|
|
<META HTTP-EQUIV="Organization" CONTENT="LispWorks Ltd.">
|
|
<LINK REL=TOP HREF="../Front/index.htm">
|
|
<LINK REL=COPYRIGHT HREF="../Front/Help.htm#Legal">
|
|
<LINK REL=DISCLAIMER HREF="../Front/Help.htm#Disclaimer">
|
|
<LINK REL=PREV HREF="03_bdc.htm">
|
|
<LINK REL=UP HREF="03_bd.htm">
|
|
<LINK REL=NEXT HREF="03_be.htm">
|
|
</HEAD>
|
|
<BODY>
|
|
<H1><A REV=MADE HREF="http://www.lispworks.com/"><IMG WIDTH=80 HEIGHT=65 ALT="[LISPWORKS]" SRC="../Graphics/LWSmall.gif" ALIGN=Bottom></A><A REL=TOP HREF="../Front/index.htm"><IMG WIDTH=237 HEIGHT=65 ALT="[Common Lisp HyperSpec (TM)]" SRC="../Graphics/CLHS_Sm.gif" ALIGN=Bottom></A> <A REL=PREV HREF="03_bdc.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="03_bd.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="03_be.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
|
|
|
|
<HR>
|
|
|
|
<H2>
|
|
3.2.4.4 Additional Constraints on Externalizable Objects</H2> <P>
|
|
If two <A REL=DEFINITION HREF="26_glo_l.htm#literal"><I>literal</I></A> <A REL=DEFINITION HREF="26_glo_o.htm#object"><I>objects</I></A> appearing in the source code for a single file processed with the <A REL=DEFINITION HREF="26_glo_f.htm#file_compiler"><I>file compiler</I></A> are the <A REL=DEFINITION HREF="26_glo_i.htm#identical"><I>identical</I></A>, the corresponding <A REL=DEFINITION HREF="26_glo_o.htm#object"><I>objects</I></A> in the <A REL=DEFINITION HREF="26_glo_c.htm#compiled_code"><I>compiled code</I></A> must also be the <A REL=DEFINITION HREF="26_glo_i.htm#identical"><I>identical</I></A>. With the exception of <A REL=DEFINITION HREF="26_glo_s.htm#symbol"><I>symbols</I></A> and <A REL=DEFINITION HREF="26_glo_p.htm#package"><I>packages</I></A>, any two <A REL=DEFINITION HREF="26_glo_l.htm#literal"><I>literal</I></A> <A REL=DEFINITION HREF="26_glo_o.htm#object"><I>objects</I></A> in <A REL=DEFINITION HREF="26_glo_c.htm#code"><I>code</I></A> being processed by the <A REL=DEFINITION HREF="26_glo_f.htm#file_compiler"><I>file compiler</I></A> may be <I>coalesced</I> if and only if they are <A REL=DEFINITION HREF="26_glo_s.htm#similar"><I>similar</I></A>; if they are either both <A REL=DEFINITION HREF="26_glo_s.htm#symbol"><I>symbols</I></A> or both <A REL=DEFINITION HREF="26_glo_p.htm#package"><I>packages</I></A>, they may only be <I>coalesced</I> if and only if they are <A REL=DEFINITION HREF="26_glo_i.htm#identical"><I>identical</I></A>. <P>
|
|
<A REL=DEFINITION HREF="26_glo_o.htm#object"><I>Objects</I></A> containing circular references can be <A REL=DEFINITION HREF="26_glo_e.htm#externalizable_object"><I>externalizable objects</I></A>. The <A REL=DEFINITION HREF="26_glo_f.htm#file_compiler"><I>file compiler</I></A> is required to preserve <A REL=DEFINITION HREF="f_eql.htm#eql"><B>eql</B></A>ness of substructures within a <A REL=DEFINITION HREF="26_glo_f.htm#file"><I>file</I></A>. Preserving <A REL=DEFINITION HREF="f_eql.htm#eql"><B>eql</B></A>ness means that subobjects that are the <A REL=DEFINITION HREF="26_glo_s.htm#same"><I>same</I></A> in the <A REL=DEFINITION HREF="26_glo_s.htm#source_code"><I>source code</I></A> must be the <A REL=DEFINITION HREF="26_glo_s.htm#same"><I>same</I></A> in the corresponding <A REL=DEFINITION HREF="26_glo_c.htm#compiled_code"><I>compiled code</I></A>. <P>
|
|
In addition, the following are constraints on the handling of <A REL=DEFINITION HREF="26_glo_l.htm#literal"><I>literal</I></A> <A REL=DEFINITION HREF="26_glo_o.htm#object"><I>objects</I></A> by the <A REL=DEFINITION HREF="26_glo_f.htm#file_compiler"><I>file compiler</I></A>: <P>
|
|
<P><DL><P>
|
|
<DT> <B>array:</B> If an <A REL=DEFINITION HREF="26_glo_a.htm#array"><I>array</I></A> in the source code is a <A REL=DEFINITION HREF="26_glo_s.htm#simple_array"><I>simple array</I></A>, then the corresponding <A REL=DEFINITION HREF="26_glo_a.htm#array"><I>array</I></A> in the compiled code will also be a <A REL=DEFINITION HREF="26_glo_s.htm#simple_array"><I>simple array</I></A>. If an <A REL=DEFINITION HREF="26_glo_a.htm#array"><I>array</I></A> in the source code is displaced, has a <A REL=DEFINITION HREF="26_glo_f.htm#fill_pointer"><I>fill pointer</I></A>, or is <A REL=DEFINITION HREF="26_glo_a.htm#actually_adjustable"><I>actually adjustable</I></A>, the corresponding <A REL=DEFINITION HREF="26_glo_a.htm#array"><I>array</I></A> in the compiled code might lack any or all of these qualities. If an <A REL=DEFINITION HREF="26_glo_a.htm#array"><I>array</I></A> in the source code has a fill pointer, then the corresponding <A REL=DEFINITION HREF="26_glo_a.htm#array"><I>array</I></A> in the compiled code might be only the size implied by the fill pointer. <P><DD>
|
|
<DT> <B>packages:</B> The loader is required to find the corresponding <A REL=DEFINITION HREF="26_glo_p.htm#package"><I>package</I></A> <A REL=DEFINITION HREF="26_glo_o.htm#object"><I>object</I></A> as if by calling <A REL=DEFINITION HREF="f_find_p.htm#find-package"><B>find-package</B></A> with the package name as an argument. An error of <A REL=DEFINITION HREF="26_glo_t.htm#type"><I>type</I></A> <A REL=DEFINITION HREF="e_pkg_er.htm#package-error"><B>package-error</B></A> is signaled if no <A REL=DEFINITION HREF="26_glo_p.htm#package"><I>package</I></A> of that name exists at load time. <P><DD>
|
|
<DT> <B>random-state:</B> A constant <A REL=DEFINITION HREF="26_glo_r.htm#random_state"><I>random state</I></A> object cannot be used as the state argument to the <A REL=DEFINITION HREF="26_glo_f.htm#function"><I>function</I></A> <A REL=DEFINITION HREF="f_random.htm#random"><B>random</B></A> because <A REL=DEFINITION HREF="f_random.htm#random"><B>random</B></A> modifies this data structure. <P><DD>
|
|
<DT> <B>structure, standard-object:</B> <A REL=DEFINITION HREF="26_glo_o.htm#object"><I>Objects</I></A> of <A REL=DEFINITION HREF="26_glo_t.htm#type"><I>type</I></A> <A REL=DEFINITION HREF="t_stu_ob.htm#structure-object"><B>structure-object</B></A> and <A REL=DEFINITION HREF="t_std_ob.htm#standard-object"><B>standard-object</B></A> may appear in compiled constants if there is an appropriate <A REL=DEFINITION HREF="f_mk_ld_.htm#make-load-form"><B>make-load-form</B></A> method defined for that <A REL=DEFINITION HREF="26_glo_t.htm#type"><I>type</I></A>. <P><DD>
|
|
The <A REL=DEFINITION HREF="26_glo_f.htm#file_compiler"><I>file compiler</I></A> calls <A REL=DEFINITION HREF="f_mk_ld_.htm#make-load-form"><B>make-load-form</B></A> on any <A REL=DEFINITION HREF="26_glo_o.htm#object"><I>object</I></A> that is referenced as a <A REL=DEFINITION HREF="26_glo_l.htm#literal"><I>literal</I></A> <A REL=DEFINITION HREF="26_glo_o.htm#object"><I>object</I></A> if the <A REL=DEFINITION HREF="26_glo_o.htm#object"><I>object</I></A> is a <A REL=DEFINITION HREF="26_glo_g.htm#generalized_instance"><I>generalized instance</I></A> of <A REL=DEFINITION HREF="t_std_ob.htm#standard-object"><B>standard-object</B></A>, <A REL=DEFINITION HREF="t_stu_ob.htm#structure-object"><B>structure-object</B></A>, <A REL=DEFINITION HREF="e_cnd.htm#condition"><B>condition</B></A>, or any of a (possibly empty) <A REL=DEFINITION HREF="26_glo_i.htm#implementation-dependent"><I>implementation-dependent</I></A> set of other <A REL=DEFINITION HREF="26_glo_c.htm#class"><I>classes</I></A>. The <A REL=DEFINITION HREF="26_glo_f.htm#file_compiler"><I>file compiler</I></A> only calls <A REL=DEFINITION HREF="f_mk_ld_.htm#make-load-form"><B>make-load-form</B></A> once for any given <A REL=DEFINITION HREF="26_glo_o.htm#object"><I>object</I></A> within a single <A REL=DEFINITION HREF="26_glo_f.htm#file"><I>file</I></A>. <P>
|
|
<DT> <B>symbol:</B> In order to guarantee that <A REL=DEFINITION HREF="26_glo_c.htm#compiled_file"><I>compiled files</I></A> can be <I>loaded</I> correctly, users must ensure that the <A REL=DEFINITION HREF="26_glo_p.htm#package"><I>packages</I></A> referenced in those <A REL=DEFINITION HREF="26_glo_f.htm#file"><I>files</I></A> are defined consistently at compile time and load time. <A REL=DEFINITION HREF="26_glo_c.htm#conforming_program"><I>Conforming programs</I></A> must satisfy the following requirements: <P><DD>
|
|
<P><OL><LI> The <A REL=DEFINITION HREF="26_glo_c.htm#current_package"><I>current package</I></A> when a <A REL=DEFINITION HREF="26_glo_t.htm#top_level_form"><I>top level form</I></A> in the <A REL=DEFINITION HREF="26_glo_f.htm#file"><I>file</I></A> is processed by <A REL=DEFINITION HREF="f_cmp_fi.htm#compile-file"><B>compile-file</B></A> must be the same as the <A REL=DEFINITION HREF="26_glo_c.htm#current_package"><I>current package</I></A> when the <A REL=DEFINITION HREF="26_glo_c.htm#code"><I>code</I></A> corresponding to that <A REL=DEFINITION HREF="26_glo_t.htm#top_level_form"><I>top level form</I></A> in the <A REL=DEFINITION HREF="26_glo_c.htm#compiled_file"><I>compiled file</I></A> is executed by <A REL=DEFINITION HREF="f_load.htm#load"><B>load</B></A>. In particular: <P>
|
|
<P><DL><P>
|
|
<DT>a. Any <A REL=DEFINITION HREF="26_glo_t.htm#top_level_form"><I>top level form</I></A> in a <A REL=DEFINITION HREF="26_glo_f.htm#file"><I>file</I></A> that alters the <A REL=DEFINITION HREF="26_glo_c.htm#current_package"><I>current package</I></A> must change it to a <A REL=DEFINITION HREF="26_glo_p.htm#package"><I>package</I></A> of the same <A REL=DEFINITION HREF="26_glo_n.htm#name"><I>name</I></A> both at compile time and at load time. <P><DD>
|
|
<DT>b. If the first <A REL=DEFINITION HREF="26_glo_n.htm#non-atomic"><I>non-atomic</I></A> <A REL=DEFINITION HREF="26_glo_t.htm#top_level_form"><I>top level form</I></A> in the <A REL=DEFINITION HREF="26_glo_f.htm#file"><I>file</I></A> is not an <A REL=DEFINITION HREF="m_in_pkg.htm#in-package"><B>in-package</B></A> <A REL=DEFINITION HREF="26_glo_f.htm#form"><I>form</I></A>, then the <A REL=DEFINITION HREF="26_glo_c.htm#current_package"><I>current package</I></A> at the time <A REL=DEFINITION HREF="f_load.htm#load"><B>load</B></A> is called must be a <A REL=DEFINITION HREF="26_glo_p.htm#package"><I>package</I></A> with the same <A REL=DEFINITION HREF="26_glo_n.htm#name"><I>name</I></A> as the package that was the <A REL=DEFINITION HREF="26_glo_c.htm#current_package"><I>current package</I></A> at the time <A REL=DEFINITION HREF="f_cmp_fi.htm#compile-file"><B>compile-file</B></A> was called. <P><DD></DL><P>
|
|
<LI> For all <A REL=DEFINITION HREF="26_glo_s.htm#symbol"><I>symbols</I></A> appearing lexically within a <A REL=DEFINITION HREF="26_glo_t.htm#top_level_form"><I>top level form</I></A> that were <A REL=DEFINITION HREF="26_glo_a.htm#accessible"><I>accessible</I></A> in the <A REL=DEFINITION HREF="26_glo_p.htm#package"><I>package</I></A> that was the <A REL=DEFINITION HREF="26_glo_c.htm#current_package"><I>current package</I></A> during processing of that <A REL=DEFINITION HREF="26_glo_t.htm#top_level_form"><I>top level form</I></A> at compile time, but whose <A REL=DEFINITION HREF="26_glo_h.htm#home_package"><I>home package</I></A> was another <A REL=DEFINITION HREF="26_glo_p.htm#package"><I>package</I></A>, at load time there must be a <A REL=DEFINITION HREF="26_glo_s.htm#symbol"><I>symbol</I></A> with the same <A REL=DEFINITION HREF="26_glo_n.htm#name"><I>name</I></A> that is <A REL=DEFINITION HREF="26_glo_a.htm#accessible"><I>accessible</I></A> in both the load-time <A REL=DEFINITION HREF="26_glo_c.htm#current_package"><I>current package</I></A> and in the <A REL=DEFINITION HREF="26_glo_p.htm#package"><I>package</I></A> with the same <A REL=DEFINITION HREF="26_glo_n.htm#name"><I>name</I></A> as the compile-time <A REL=DEFINITION HREF="26_glo_h.htm#home_package"><I>home package</I></A>. <P>
|
|
<LI> For all <A REL=DEFINITION HREF="26_glo_s.htm#symbol"><I>symbols</I></A> represented in the <A REL=DEFINITION HREF="26_glo_c.htm#compiled_file"><I>compiled file</I></A> that were <A REL=DEFINITION HREF="26_glo_e.htm#external_symbol"><I>external symbols</I></A> in their <A REL=DEFINITION HREF="26_glo_h.htm#home_package"><I>home package</I></A> at compile time, there must be a <A REL=DEFINITION HREF="26_glo_s.htm#symbol"><I>symbol</I></A> with the same <A REL=DEFINITION HREF="26_glo_n.htm#name"><I>name</I></A> that is an <A REL=DEFINITION HREF="26_glo_e.htm#external_symbol"><I>external symbol</I></A> in the <A REL=DEFINITION HREF="26_glo_p.htm#package"><I>package</I></A> with the same <A REL=DEFINITION HREF="26_glo_n.htm#name"><I>name</I></A> at load time. <P></OL><P>
|
|
If any of these conditions do not hold, the <A REL=DEFINITION HREF="26_glo_p.htm#package"><I>package</I></A> in which the <A REL=DEFINITION HREF="26_glo_l.htm#loader"><I>loader</I></A> looks for the affected <A REL=DEFINITION HREF="26_glo_s.htm#symbol"><I>symbols</I></A> is unspecified. <A REL=DEFINITION HREF="26_glo_i.htm#implementation"><I>Implementations</I></A> are permitted to signal an error or to define this behavior. <P>
|
|
<P></DL><P>
|
|
<P><HR>The following <A REL=META HREF="../Front/X3J13Iss.htm">X3J13 cleanup issues</A>, <I>not part of the specification</I>, apply to this section:<P><UL><LI> <A REL=CHILD HREF="../Issues/iss063.htm">COMPILE-FILE-SYMBOL-HANDLING:NEW-REQUIRE-CONSISTENCY</A><LI> <A REL=CHILD HREF="../Issues/iss236.htm">MAKE-LOAD-FORM-CONFUSION:REWRITE</A><LI> <A REL=CHILD HREF="../Issues/iss215.htm">LOAD-OBJECTS:MAKE-LOAD-FORM</A><LI> <A REL=CHILD HREF="../Issues/iss079.htm">CONSTANT-CIRCULAR-COMPILATION:YES</A><LI> <A REL=CHILD HREF="../Issues/iss080.htm">CONSTANT-COLLAPSING:GENERALIZE</A><P></UL><HR>
|
|
|
|
<A REL=NAVIGATOR HREF="../Front/StartPts.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Starting Points]" SRC="../Graphics/StartPts.gif" ALIGN=Bottom></A><A REL=TOC HREF="../Front/Contents.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Contents]" SRC="../Graphics/Contents.gif" ALIGN=Bottom></A><A REL=INDEX HREF="../Front/X_Master.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Index]" SRC="../Graphics/Index.gif" ALIGN=Bottom></A><A REL=INDEX HREF="../Front/X_Symbol.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Symbols]" SRC="../Graphics/Symbols.gif" ALIGN=Bottom></A><A REL=GLOSSARY HREF="../Body/26_a.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Glossary]" SRC="../Graphics/Glossary.gif" ALIGN=Bottom></A><A HREF="../Front/X3J13Iss.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Issues]" SRC="../Graphics/Issues.gif" ALIGN=Bottom></A><BR>
|
|
|
|
<A REL=COPYRIGHT HREF="../Front/Help.htm#Legal"><I>Copyright 1996-2005, LispWorks Ltd. All rights reserved.</I></A><P>
|
|
</BODY>
|
|
</HTML>
|