134 lines
8.3 KiB
HTML
134 lines
8.3 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: Issue LEXICAL-CONSTRUCT-GLOBAL-DEFINITION Writeup</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="../Issues/iss210_w.htm">
|
|
<LINK REL=UP HREF="../Issues/iss211.htm">
|
|
<LINK REL=NEXT HREF="../Issues/iss212_w.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="../Issues/iss210_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="../Issues/iss211.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="../Issues/iss212_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
<H2>Issue LEXICAL-CONSTRUCT-GLOBAL-DEFINITION Writeup</H2>
|
|
|
|
<PRE><B>Issue:</B> <A HREF="iss211.htm">LEXICAL-CONSTRUCT-GLOBAL-DEFINITION</A> <P>
|
|
<B>References:</B> <A REL=DEFINITION HREF="../Body/m_ppr_ex.htm#pprint-exit-if-list-exhausted"><B>PPRINT-EXIT-IF-LIST-EXHAUSTED</B></A><P>
|
|
<A REL=DEFINITION HREF="../Body/m_ppr_po.htm#pprint-pop"><B>PPRINT-POP</B></A><P>
|
|
<A REL=DEFINITION HREF="../Body/m_loop_f.htm#loop-finish"><B>LOOP-FINISH</B></A><P>
|
|
<A REL=DEFINITION HREF="../Body/m_call_m.htm#call-method"><B>CALL-METHOD</B></A><P>
|
|
<A REL=DEFINITION HREF="../Body/f_call_n.htm#call-next-method"><B>CALL-NEXT-METHOD</B></A><P>
|
|
<A REL=DEFINITION HREF="../Body/f_next_m.htm#next-method-p"><B>NEXT-METHOD-P</B></A><P>
|
|
Related issues: Issue <A HREF="iss214.htm">LISP-SYMBOL-REDEFINITION</A><P>
|
|
Issue <A HREF="iss270.htm">PRETTY-PRINT-INTERFACE</A><P>
|
|
Issue LOOP-FINISH-NOT-FINISHED<P>
|
|
<B>Category:</B> CLARIFICATION, CHANGE<P>
|
|
<B>Edit history:</B> V1, 05 May 90, Sandra Loosemore<P>
|
|
V2, 29 May 90, Sandra Loosemore (forgot one)<P>
|
|
<P>
|
|
<B>Problem description:<P>
|
|
</B><P>
|
|
The description of <A REL=DEFINITION HREF="../Body/m_ppr_ex.htm#pprint-exit-if-list-exhausted"><B>PPRINT-EXIT-IF-LIST-EXHAUSTED</B></A> and <A REL=DEFINITION HREF="../Body/m_ppr_po.htm#pprint-pop"><B>PPRINT-POP</B></A><P>
|
|
in issue <A HREF="iss270.htm">PRETTY-PRINT-INTERFACE</A> specifies that "an error message<P>
|
|
is issued" if either of these constructs are used anywhere other<P>
|
|
than syntactically nested within a call on <A REL=DEFINITION HREF="../Body/m_ppr_lo.htm#pprint-logical-block"><B>PPRINT-LOGICAL-BLOCK</B></A>.<P>
|
|
It is not clear whether this means "an error is signalled" or<P>
|
|
"a message is printed", or whether this situation must be<P>
|
|
detected at compile time or at run time.<P>
|
|
<P>
|
|
This is actually a more general problem, since there are other <P>
|
|
constructs in the language that have similar scoping requirements: <P>
|
|
notably <A REL=DEFINITION HREF="../Body/m_loop_f.htm#loop-finish"><B>LOOP-FINISH</B></A>, <A REL=DEFINITION HREF="../Body/m_call_m.htm#call-method"><B>CALL-METHOD</B></A>, <A REL=DEFINITION HREF="../Body/f_call_n.htm#call-next-method"><B>CALL-NEXT-METHOD</B></A>, and <A REL=DEFINITION HREF="../Body/f_next_m.htm#next-method-p"><B>NEXT-METHOD-P</B></A>. <P>
|
|
The error behavior of all of these constructs when they are referenced<P>
|
|
outside the lexical scope where their behavior is defined ought<P>
|
|
to be made consistent, as should the matter of whether they<P>
|
|
are permitted/required/not allowed to be globally <A REL=DEFINITION HREF="../Body/f_fbound.htm#fboundp"><B>FBOUNDP</B></A>. <P>
|
|
<P>
|
|
This issue incorporates items #2 and #23 from Loosemore's list.<P>
|
|
<P>
|
|
<B>Proposal (LEXICAL-CONSTRUCT-GLOBAL-DEFINITION:UNDEFINED):<P>
|
|
</B><P>
|
|
This proposal affects the constructs <A REL=DEFINITION HREF="../Body/m_ppr_ex.htm#pprint-exit-if-list-exhausted"><B>PPRINT-EXIT-IF-LIST-EXHAUSTED</B></A>, <P>
|
|
<A REL=DEFINITION HREF="../Body/m_ppr_po.htm#pprint-pop"><B>PPRINT-POP</B></A>, <A REL=DEFINITION HREF="../Body/m_loop_f.htm#loop-finish"><B>LOOP-FINISH</B></A>, <A REL=DEFINITION HREF="../Body/m_call_m.htm#call-method"><B>CALL-METHOD</B></A>, <A REL=DEFINITION HREF="../Body/f_call_n.htm#call-next-method"><B>CALL-NEXT-METHOD</B></A>, and <P>
|
|
<A REL=DEFINITION HREF="../Body/f_next_m.htm#next-method-p"><B>NEXT-METHOD-P</B></A>, which are referred to as "lexically-scoped operators".<P>
|
|
<P>
|
|
(1) Change the descriptions of lexically-scoped operators to<P>
|
|
state that any attempt to invoke the operator outside of the<P>
|
|
lexical scope where its behavior is defined has undefined<P>
|
|
consequences.<P>
|
|
<P>
|
|
(2) Clarify that it is unspecified whether function names that<P>
|
|
are defined by the <A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A> as lexically-scoped operators have<P>
|
|
global function or macro definitions (i.e., are <A REL=DEFINITION HREF="../Body/f_fbound.htm#fboundp"><B>FBOUNDP</B></A>).<P>
|
|
<P>
|
|
(3) Clarify that the restrictions on redefinition or shadowing<P>
|
|
of symbols in the COMMON-LISP package (originally stated in issue <P>
|
|
<A HREF="iss214.htm">LISP-SYMBOL-REDEFINITION</A>) are the same for symbols that define <P>
|
|
lexical operators as for symbols that are globally defined as<P>
|
|
operators.<P>
|
|
<P>
|
|
<B>Rationale:<P>
|
|
</B><P>
|
|
This gives maximum freedom to implementors and avoids having to<P>
|
|
deal with sticky issues about whether errors are detected at<P>
|
|
compile or run time, etc.<P>
|
|
<P>
|
|
<B>Current Practice:<P>
|
|
</B><P>
|
|
I suspect it is fairly common practice to define these operators<P>
|
|
using <A REL=DEFINITION HREF="../Body/s_flet_.htm#macrolet"><B>MACROLET</B></A> (etc) and <A REL=DEFINITION HREF="../Body/f_provid.htm#provide"><B>provide</B></A> a global definition that<P>
|
|
signals an error if it is invoked.<P>
|
|
<P>
|
|
<B>Cost to Implementors:<P>
|
|
</B><P>
|
|
None.<P>
|
|
<P>
|
|
<B>Cost to Users:<P>
|
|
</B><P>
|
|
None.<P>
|
|
<P>
|
|
<B>Cost of non-adoption:<P>
|
|
</B><P>
|
|
Part of the language specification remains imprecise,<P>
|
|
inconsistent, and confusing.<P>
|
|
<P>
|
|
<B>Performance impact:<P>
|
|
</B><P>
|
|
None.<P>
|
|
<P>
|
|
<B>Benefits:<P>
|
|
</B><P>
|
|
The language specification is made more precise, consistent,<P>
|
|
and less confusing.<P>
|
|
<P>
|
|
<B>Esthetics:<P>
|
|
</B><P>
|
|
Treating all of these guys uniformly is better than having them<P>
|
|
all specify something slightly different with regard to their<P>
|
|
behavior.<P>
|
|
<P>
|
|
<B>Discussion:<P>
|
|
</B><P>
|
|
The situation with the <A REL=DEFINITION HREF="../Body/s_declar.htm#declare"><B>DECLARE</B></A> special form is related but not<P>
|
|
entirely analogous, so it has been left out of this proposal.<P>
|
|
From a purely abstract point of view, <A REL=DEFINITION HREF="../Body/s_declar.htm#declare"><B>DECLARE</B></A> is not a special form <P>
|
|
at all but simply a syntactic marker like <A REL=DEFINITION HREF="../Body/a_lambda.htm#lambda"><B>LAMBDA</B></A>, and the only<P>
|
|
reason for defining it as an operator is to facilitate diagnostics <P>
|
|
about misplaced declarations.<P>
|
|
</PRE>
|
|
<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>
|