40 lines
8 KiB
HTML
40 lines
8 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.3.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_cca.htm">
|
|
<LINK REL=UP HREF="03_c.htm">
|
|
<LINK REL=NEXT HREF="03_cda.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_cca.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="03_c.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="03_cda.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
|
|
|
|
<HR>
|
|
|
|
<H2>
|
|
3.3.4 Declaration Scope</H2> <P>
|
|
<A REL=DEFINITION HREF="26_glo_d.htm#declaration"><I>Declarations</I></A> can be divided into two kinds: those that apply to the <A REL=DEFINITION HREF="26_glo_b.htm#binding"><I>bindings</I></A> of <A REL=DEFINITION HREF="26_glo_v.htm#variable"><I>variables</I></A> or <A REL=DEFINITION HREF="26_glo_f.htm#function"><I>functions</I></A>; and those that do not apply to <A REL=DEFINITION HREF="26_glo_b.htm#binding"><I>bindings</I></A>. <P>
|
|
A <A REL=DEFINITION HREF="26_glo_d.htm#declaration"><I>declaration</I></A> that appears at the head of a binding <A REL=DEFINITION HREF="26_glo_f.htm#form"><I>form</I></A> and applies to a <A REL=DEFINITION HREF="26_glo_v.htm#variable"><I>variable</I></A> or <A REL=DEFINITION HREF="26_glo_f.htm#function"><I>function</I></A> <A REL=DEFINITION HREF="26_glo_b.htm#binding"><I>binding</I></A> made by that <A REL=DEFINITION HREF="26_glo_f.htm#form"><I>form</I></A> is called a <A REL=DEFINITION HREF="26_glo_b.htm#bound_declaration"><I>bound declaration</I></A>; such a <A REL=DEFINITION HREF="26_glo_d.htm#declaration"><I>declaration</I></A> affects both the <A REL=DEFINITION HREF="26_glo_b.htm#binding"><I>binding</I></A> and any references within the <A REL=DEFINITION HREF="26_glo_s.htm#scope"><I>scope</I></A> of the <A REL=DEFINITION HREF="26_glo_d.htm#declaration"><I>declaration</I></A>. <P>
|
|
<A REL=DEFINITION HREF="26_glo_d.htm#declaration"><I>Declarations</I></A> that are not <A REL=DEFINITION HREF="26_glo_b.htm#bound_declaration"><I>bound declarations</I></A> are called <A REL=DEFINITION HREF="26_glo_f.htm#free_declaration"><I>free declarations</I></A>. <P>
|
|
A <A REL=DEFINITION HREF="26_glo_f.htm#free_declaration"><I>free declaration</I></A> in a <A REL=DEFINITION HREF="26_glo_f.htm#form"><I>form</I></A> F1 that applies to a <A REL=DEFINITION HREF="26_glo_b.htm#binding"><I>binding</I></A> for a <A REL=DEFINITION HREF="26_glo_n.htm#name"><I>name</I></A> N <I>established</I> by some <A REL=DEFINITION HREF="26_glo_f.htm#form"><I>form</I></A> F2 of which F1 is a <A REL=DEFINITION HREF="26_glo_s.htm#subform"><I>subform</I></A> affects only references to N within F1; it does not to apply to other references to N outside of F1, nor does it affect the manner in which the <A REL=DEFINITION HREF="26_glo_b.htm#binding"><I>binding</I></A> of N by F2 is <I>established</I>. <P>
|
|
<A REL=DEFINITION HREF="26_glo_d.htm#declaration"><I>Declarations</I></A> that do not apply to <A REL=DEFINITION HREF="26_glo_b.htm#binding"><I>bindings</I></A> can only appear as <A REL=DEFINITION HREF="26_glo_f.htm#free_declaration"><I>free declarations</I></A>. <P>
|
|
The <A REL=DEFINITION HREF="26_glo_s.htm#scope"><I>scope</I></A> of a <A REL=DEFINITION HREF="26_glo_b.htm#bound_declaration"><I>bound declaration</I></A> is the same as the <A REL=DEFINITION HREF="26_glo_l.htm#lexical_scope"><I>lexical scope</I></A> of the <A REL=DEFINITION HREF="26_glo_b.htm#binding"><I>binding</I></A> to which it applies; for <A REL=DEFINITION HREF="26_glo_s.htm#special_variable"><I>special variables</I></A>, this means the <A REL=DEFINITION HREF="26_glo_s.htm#scope"><I>scope</I></A> that the <A REL=DEFINITION HREF="26_glo_b.htm#binding"><I>binding</I></A> would have had had it been a <A REL=DEFINITION HREF="26_glo_l.htm#lexical_binding"><I>lexical binding</I></A>. <P>
|
|
Unless explicitly stated otherwise, the <A REL=DEFINITION HREF="26_glo_s.htm#scope"><I>scope</I></A> of a <A REL=DEFINITION HREF="26_glo_f.htm#free_declaration"><I>free declaration</I></A> includes only the body <A REL=DEFINITION HREF="26_glo_s.htm#subform"><I>subforms</I></A> of the <A REL=DEFINITION HREF="26_glo_f.htm#form"><I>form</I></A> at whose head it appears, and no other <A REL=DEFINITION HREF="26_glo_s.htm#subform"><I>subforms</I></A>. The <A REL=DEFINITION HREF="26_glo_s.htm#scope"><I>scope</I></A> of <A REL=DEFINITION HREF="26_glo_f.htm#free_declaration"><I>free declarations</I></A> specifically does not include <A REL=DEFINITION HREF="26_glo_i.htm#initialization_form"><I>initialization forms</I></A> for <A REL=DEFINITION HREF="26_glo_b.htm#binding"><I>bindings</I></A> established by the <A REL=DEFINITION HREF="26_glo_f.htm#form"><I>form</I></A> containing the <A REL=DEFINITION HREF="26_glo_d.htm#declaration"><I>declarations</I></A>. <P>
|
|
Some <A REL=DEFINITION HREF="26_glo_i.htm#iteration_form"><I>iteration forms</I></A> include step, end-test, or result <A REL=DEFINITION HREF="26_glo_s.htm#subform"><I>subforms</I></A> that are also included in the <A REL=DEFINITION HREF="26_glo_s.htm#scope"><I>scope</I></A> of <A REL=DEFINITION HREF="26_glo_d.htm#declaration"><I>declarations</I></A> that appear in the <A REL=DEFINITION HREF="26_glo_i.htm#iteration_form"><I>iteration form</I></A>. Specifically, the <A REL=DEFINITION HREF="26_glo_i.htm#iteration_form"><I>iteration forms</I></A> and <A REL=DEFINITION HREF="26_glo_s.htm#subform"><I>subforms</I></A> involved are: <P>
|
|
<P><UL><LI> <A REL=DEFINITION HREF="m_do_do.htm#do"><B>do</B></A>, <A REL=DEFINITION HREF="m_do_do.htm#doST"><B>do*</B></A>: <I>step-forms</I>, <I>end-test-form</I>, and <I>result-forms</I>. <LI> <A REL=DEFINITION HREF="m_dolist.htm#dolist"><B>dolist</B></A>, <A REL=DEFINITION HREF="m_dotime.htm#dotimes"><B>dotimes</B></A>: <I>result-form</I> <LI> <A REL=DEFINITION HREF="m_do_sym.htm#do-all-symbols"><B>do-all-symbols</B></A>, <A REL=DEFINITION HREF="m_do_sym.htm#do-external-symbols"><B>do-external-symbols</B></A>, <A REL=DEFINITION HREF="m_do_sym.htm#do-symbols"><B>do-symbols</B></A>: <I>result-form</I> <P></UL> <P>
|
|
|
|
|
|
<A REL=CHILD HREF="03_cda.htm"><H2>
|
|
3.3.4.1 Examples of Declaration Scope</H2></A><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/iss181.htm">GENERIC-FLET-POORLY-DESIGNED:DELETE</A><LI> <A REL=CHILD HREF="../Issues/iss359.htm">WITH-ADDED-METHODS:DELETE</A><LI> <A REL=CHILD HREF="../Issues/iss092.htm">DECLARATION-SCOPE:NO-HOISTING</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>
|