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

141 lines
7.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: Issue FORMAT-COLON-UPARROW-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/iss164_w.htm">
<LINK REL=UP HREF="../Issues/iss165.htm">
<LINK REL=NEXT HREF="../Issues/iss166_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/iss164_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="../Issues/iss165.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="../Issues/iss166_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
<HR>
<H2>Issue FORMAT-COLON-UPARROW-SCOPE Writeup</H2>
<PRE><B>Issue:</B> <A HREF="iss165.htm">FORMAT-COLON-UPARROW-SCOPE</A><P>
<P>
<B>References:</B> CLtL p. 406 and also p. 403<P>
<P>
<B>Category:</B> CLARIFICATION<P>
<P>
<B>Edit history:</B> version 1: Guy Steele, 30 November 1987<P>
version 2: Guy Steele, 18 January 1988<P>
version 3: Masinter, 5 February 1988<P>
<P>
<B>Problem description:<P>
</B><P>
Implementations currently differ on the question of what is tested by the <A REL=DEFINITION HREF="../Body/f_format.htm#format"><B>FORMAT</B></A><P>
command &quot;~:^&quot;. Some implementations test to see whether any arguments remain in<P>
the sublist for the current iteration step; others test to see whether any<P>
sublists remain. The text on page 406 is not clear on this point.<P>
<P>
<B>Proposal (FORMAT-COLON-UPARROW-SCOPE:TEST-FOR-REMAINING-SUBLISTS):<P>
</B><P>
~:^ may be used only if the command it would terminate is ~:{ or ~:@{. The<P>
entire iteration process is terminated if and only if the sublist that is<P>
supplying the arguments for the current iteration step is the last sublist (in<P>
the case of ~:{) or the last <A REL=DEFINITION HREF="../Body/f_format.htm#format"><B>FORMAT</B></A> argument (~:@{). Note that ~:^ is *not*<P>
equivalent to ~:#^; the latter terminates the entire iteration if and only if no<P>
arguments remain for the current iteration step.<P>
<P>
<B>Example:<P>
</B><P>
(<A REL=DEFINITION HREF="../Body/f_format.htm#format"><B>format</B></A> <A REL=DEFINITION HREF="../Body/a_nil.htm#nil"><B>nil</B></A> &quot;~:{~@?~:^...~}&quot; '((&quot;a&quot;) (&quot;b&quot;)))<P>
<P>
Under this proposal, this yields &quot;a...b&quot;, rather than &quot;a&quot;.<P>
<P>
<B>Rationale:<P>
</B><P>
This proposal is desirable because otherwise there is no way to test whether any<P>
sublists remain. The text on page 406 may be construed to hint at this proposal<P>
indirectly. To quote Nick Gall:<P>
<P>
&quot;If one thinks about the intent of the parenthetical `(because in the <A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A><P>
case it tests for remaining arguments of the current step only)', one should<P>
agree that &quot;a...b&quot; will be returned. In referring to ~^ as the `<A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A> case',<P>
which tests the arguments remaining in the current argument sublist, this<P>
parenthetical implies that there is an `other case', which tests `something<P>
else.' The only `other case' discussed is ~:^, which therefore must test<P>
`something else.' I claim that the parentheical makes no sense if we interpret<P>
~:^ as testing the same condition as ~^. If they both test the same condition,<P>
why have the parenthetical explanation?<P>
<P>
&quot;If ~:^ doesn't test the same condition as ~^, then what does it test? I claim<P>
that the only test that makes sense is for ~:^ to test the only thing that<P>
affects the `entire iteration process:' the number of sublists. When there are<P>
no more sublists, `the entire iteration process' is terminated.&quot;<P>
<P>
<B>Current practice:<P>
</B><P>
Some implementations already have the proposed behavior, including Symbolics<P>
Common Lisp and TI Lisp.<P>
<P>
Many other implementations currently have a different interpretation: the test<P>
case returns &quot;a&quot;, since ~:^ in those implementations test for the remaining<P>
arguments rather than remaining sublists. These currently include Kyoto Common<P>
Lisp, Allegro Common Lisp, GCLISP, Xerox Common Lisp, Spice Lisp, and VAXLISP.<P>
<P>
<B>Cost to Implementors:<P>
</B><P>
Many implementations will have to make a small change, probably a one-liner.<P>
<P>
<B>Cost to Users:<P>
</B><P>
It is unlikely that much user code depends on the behavior of testing for<P>
remaining arguments, but it is possible. The author of this writeup (Steele)<P>
judges it somewhat more likely that user code might depend on the behavior of<P>
testing for remaining sublists.<P>
<P>
<B>Cost of non-adoption:<P>
</B><P>
Users would have to be warned not to use ~:^ in code that is meant to be<P>
portable.<P>
<P>
<B>Benefits:<P>
</B><P>
Elimination of yet one more ambiguity. The proposed semantics allows greater<P>
semantic power (there are more things one can test).<P>
<P>
<B>Esthetics:<P>
</B><P>
``Absolutely none. We're talking about <A REL=DEFINITION HREF="../Body/f_format.htm#format"><B>FORMAT</B></A> here.'' -- Guy L. Steele Jr.<P>
<P>
<B>Discussion:<P>
</B><P>
Guy Steele very strongly prefers the interpretation<P>
FORMAT-COLON-UPARROW-SCOPE:TEST-FOR-REMAINING-SUBLISTS.<P>
<P>
David Moon, Kent Pitman, Pavel Curtis, Dan Pierson, Rob Poor, Scott Fahlman and<P>
Nick Gall favor FORMAT-COLON-UPARROW-SCOPE:TEST-FOR-REMAINING-SUBLISTS.<P>
<P>
Kevin Layer and Rich Robbins have spoken in favor of an alternative proposal, to<P>
test for the remaining arguments.<P>
<P>
Historical note: Steele first implemented this &quot;feature&quot;, in Zetalisp, and so<P>
the code in Symbolics Common Lisp is likely a direct descendant of the original<P>
code. This might cause some to give weight to Steele's opinion. There are two<P>
arguments against such credence. First, there is no reason why the original<P>
code should be regarded as part of the specification of Common Lisp any more<P>
than any other implementation; plainly, Steele botched the specification when he<P>
wrote the book. Second, a professor of literature (I believe) once told Isaac<P>
Asimov concerning a short story of his (I quote from memory): &quot;Tell me, Dr.<P>
Asimov, just because you wrote the story, what makes you think you know what it<P>
means?&quot;<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>