1
0
Fork 0
cl-sites/HyperSpec-7-0/HyperSpec/Issues/iss105_w.htm
2024-04-01 10:24:07 +02:00

123 lines
7.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 DEFMACRO-BLOCK-SCOPE 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/iss104_w.htm">
<LINK REL=UP HREF="../Issues/iss105.htm">
<LINK REL=NEXT HREF="../Issues/iss106_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/iss104_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="../Issues/iss105.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="../Issues/iss106_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
<HR>
<H2>Issue DEFMACRO-BLOCK-SCOPE Writeup</H2>
<PRE><B>Forum:</B> Cleanup<P>
<B>Issue:</B> <A HREF="iss105.htm">DEFMACRO-BLOCK-SCOPE</A><P>
<B>References:</B> Issue <A HREF="iss161.htm">FLET-IMPLICIT-BLOCK</A><P>
<B>Category:</B> CLARIFICATION<P>
<B>Edit History:</B> V1, 24 Oct 1989, Sandra Loosemore<P>
V2, 10 Jul 1990, David Moon (reflect vote at November meeting)<P>
<B>Status:</B> This reflects a friendly amendment and the 15-0-1 vote at the November meeting.<P>
<P>
<B>Problem Description:<P>
</B><P>
Does the scope of the implicit <A REL=DEFINITION HREF="../Body/s_block.htm#block"><B>BLOCK</B></A> that surrounds the body of<P>
<A REL=DEFINITION HREF="../Body/m_defmac.htm#defmacro"><B>DEFMACRO</B></A>, <A REL=DEFINITION HREF="../Body/s_flet_.htm#macrolet"><B>MACROLET</B></A>, DEFINE-SETF-METHOD, <A REL=DEFINITION HREF="../Body/m_deftp.htm#deftype"><B>DEFTYPE</B></A>, and<P>
<A REL=DEFINITION HREF="../Body/m_define.htm#define-compiler-macro"><B>DEFINE-COMPILER-MACRO</B></A> (the forms that define functional objects that<P>
also support destructuring) include the bindings of the variables in<P>
the destructuring pattern? In other words, is the <A REL=DEFINITION HREF="../Body/s_block.htm#block"><B>BLOCK</B></A> visible<P>
during the evaluation of initialization forms included in the <A REL=DEFINITION HREF="../Body/a_lambda.htm#lambda"><B>lambda</B></A><P>
list?<P>
<P>
It seems clear that in forms such as <A REL=DEFINITION HREF="../Body/m_defun.htm#defun"><B>DEFUN</B></A> and <A REL=DEFINITION HREF="../Body/s_flet_.htm#flet"><B>FLET</B></A> which do not support<P>
destructuring, the <A REL=DEFINITION HREF="../Body/s_block.htm#block"><B>BLOCK</B></A> surrounds only the body and includes none of<P>
the lambda-variable binding forms.<P>
<P>
There are two proposals, INCLUDES-BINDINGS and EXCLUDES-BINDINGS.<P>
The EXCLUDES BINDING proposal passed unanimously with 1 abstention.<P>
<P>
<P>
<B>Proposal (DEFMACRO-BLOCK-SCOPE:INCLUDES-BINDINGS):<P>
</B><P>
Clarify that the scope of the implicit <A REL=DEFINITION HREF="../Body/s_block.htm#block"><B>BLOCK</B></A> in the functions defined<P>
by the forms listed above does include the initialization forms within<P>
the <A REL=DEFINITION HREF="../Body/a_lambda.htm#lambda"><B>lambda</B></A> list as well as the body forms.<P>
<P>
Rationale:<P>
<P>
One can view the destructuring code which binds the variables in the<P>
<A REL=DEFINITION HREF="../Body/a_lambda.htm#lambda"><B>lambda</B></A> list as part of the body of the function (for example, as <P>
equivalent to a <A REL=DEFINITION HREF="../Body/s_let_l.htm#letST"><B>LET*</B></A> or <A REL=DEFINITION HREF="../Body/m_destru.htm#destructuring-bind"><B>DESTRUCTURING-BIND</B></A> construct), which would<P>
be inside the scope of the <A REL=DEFINITION HREF="../Body/s_block.htm#block"><B>BLOCK</B></A> in an ordinary function-defining form.<P>
Some users might find this behavior marginally more useful than the<P>
other alternative.<P>
<P>
<P>
<B>Proposal (DEFMACRO-BLOCK-SCOPE:EXCLUDES-BINDINGS):<P>
</B><P>
Clarify that the scope of the implicit <A REL=DEFINITION HREF="../Body/s_block.htm#block"><B>BLOCK</B></A> in the functions defined<P>
by the forms listed above includes only the body forms and not the<P>
initialization forms within the <A REL=DEFINITION HREF="../Body/a_lambda.htm#lambda"><B>lambda</B></A> list.<P>
<P>
Rationale:<P>
<P>
One can view the destructuring code which binds the variables in the<P>
<A REL=DEFINITION HREF="../Body/a_lambda.htm#lambda"><B>lambda</B></A> list as part of the ordinary lambda-list processing (for example,<P>
as equivalent to binding <A REL=DEFINITION HREF="../Body/03_da.htm#AMaux"><B>&amp;AUX</B></A> variables), which would be outside the<P>
scope of the <A REL=DEFINITION HREF="../Body/s_block.htm#block"><B>BLOCK</B></A> in an ordinary function-defining form. Some people<P>
might find this to be more consistent with the scoping of the <A REL=DEFINITION HREF="../Body/s_block.htm#block"><B>BLOCK</B></A> <P>
in the non-destructuring cases.<P>
<P>
<P>
<B>Current Practice:<P>
</B><P>
Lucid CL, Utah CL, and CMU Common Lisp currently implement proposal<P>
INCLUDES-BINDINGS. Kyoto CL implements proposal EXCLUDES-BINDINGS.<P>
<P>
<P>
<B>Cost to implementors:<P>
</B><P>
Probably not too much effort involved to fix it.<P>
<P>
<P>
<B>Cost to users:<P>
</B><P>
Currently nonportable user programs that depend on this being done the<P>
other way will break, but this is a rather obscure point and it is<P>
unlikely that there would be many programs affected.<P>
<P>
<P>
<B>Benefits:<P>
</B><P>
The specification of the language is made more precise.<P>
<P>
<P>
<B>Discussion:<P>
</B><P>
Sandra Loosemore says:<P>
I don't think this issue is worth spending a lot of time arguing over,<P>
since both alternatives seem equally plausible to me. I suggest we<P>
just adopt whichever alternative that is closest to current practice.<P>
I'm missing information on several implementations.<P>
<P>
A sense of the meeting is that <A REL=DEFINITION HREF="../Body/m_defun.htm#defun"><B>DEFUN</B></A> and other functions were already<P>
specified in CLTL.<P>
<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>