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

128 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 LOOP-FOR-AS-ON-TYPO 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/iss220_w.htm">
<LINK REL=UP HREF="../Issues/iss221.htm">
<LINK REL=NEXT HREF="../Issues/iss222_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/iss220_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="../Issues/iss221.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="../Issues/iss222_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
<HR>
<H2>Issue LOOP-FOR-AS-ON-TYPO Writeup</H2>
<PRE><B>Status:</B> Proposal FIX-TYPO passed 12/91<P>
<B>Issue:</B> <A HREF="iss221.htm">LOOP-FOR-AS-ON-TYPO</A><P>
Reference: X3J13/89-004 page 2-10, CLtL/II page 721, and dict-flow.tex<P>
<B>Category:</B> Clarify/fix-typo<P>
<B>Edit History:</B> Version 1 20-Aug-91 by JonL <P>
<P>
<P>
<B>Problem Description:<P>
</B><P>
From the draft proposal .tex file, under the subsection {\bf for-as-on-list},<P>
the words:<P>
<P>
In the {\it for-as-on-list\/} subclause,<P>
the {\tt for\/} <P>
or {\tt as\/} construct iterates over the contents of a <P>
@type[list]. It checks for the<P>
end of the @type[list] as if by using<P>
@funref[endp]. <P>
<P>
were erroneously copied verbatim from the subsection {\bf for-as-in-list},<P>
rather than the intended wording from the Iteration Subcommittee.<P>
<P>
At one level, this prescription doesn't make sense; by saying that <P>
it is iterating over the &quot;contents&quot;, rather than down the successive cdrs,<P>
of the list, there is confusion about the values assumed by the variable<P>
[which is subsequently said to take on the &quot;tails&quot; of the list.]<P>
<P>
In the spring of 1988, the Iteration Subcommittee suggested a change from<P>
the then existing practice of terminating both LOOP-FOR-AS-IN and <P>
LOOP-FOR-AS-ON by simply a <A REL=DEFINITION HREF="../Body/a_null.htm#null"><B>NULL</B></A> test. [Indeed, in the MacLisp days before<P>
CommonLisp, <A REL=DEFINITION HREF="../Body/f_endp.htm#endp"><B>ENDP</B></A> didn't exist; and the common use of <A REL=DEFINITION HREF="../Body/a_null.htm#null"><B>NULL</B></A> rather than <A REL=DEFINITION HREF="../Body/a_atom.htm#atom"><B>ATOM</B></A><P>
was based on a performance hack for the PDP10 Architecture.] So <A REL=DEFINITION HREF="../Body/f_endp.htm#endp"><B>ENDP</B></A> was <P>
specified for LOOP-FOR-AS-IN because that style views the list as a sequence <P>
having &quot;contents&quot; or elements; but <A REL=DEFINITION HREF="../Body/a_atom.htm#atom"><B>ATOM</B></A> was specified for LOOP-FOR-AS-ON<P>
since the only concern was the succession of list tails. The LOOP-FOR-AS-ON<P>
case is intended to be more general -- and hence have a less restrictive<P>
termination test -- so that user-defined iteration over non-standard<P>
lists can be supported. But the current draft specification completely<P>
and accidentally defeats this design.<P>
<P>
<P>
Proposal (<A HREF="iss221.htm">LOOP-FOR-AS-ON-TYPO:FIX-TYPO</A>)<P>
<P>
Restore the original wording as intended by the Iteration Subcommittee<P>
as follows:<P>
<P>
In the {\it for-as-on-list\/} subclause,<P>
the {\tt for\/} <P>
or {\tt as\/} construct iterates over a<P>
@type[list]. It checks for the<P>
end of the @type[list] as if by using<P>
@funref[atom]. <P>
<P>
<P>
<B>Editorial Impact:<P>
</B><P>
Very small.<P>
<P>
<B>Rationale:<P>
</B><P>
The evidence that this is a typo is in the Lucid Product Documentation<P>
of about the same time that 89-004 was abstracted from it; this product<P>
documentation has the &quot;correct&quot; wording, and the person responsible for<P>
doing the abstracting simply copied over the wrong, albeit very<P>
similarly worded paragraph. The two paragraphs are close together<P>
in that text.<P>
<P>
Without this fix, there will surely be gratuitous variations as to<P>
how the termination testing is done for the LOOP-FOR-AS-ON case.<P>
<P>
<P>
<B>Current Practice:<P>
</B><P>
Some existing implementations still adhere to the MacLisp inspired<P>
version that used to be distributed from MIT, which simply used <A REL=DEFINITION HREF="../Body/a_null.htm#null"><B>NULL</B></A><P>
for both the FOR-AS-IN and the FOR-AS-ON cases; some adhere to a<P>
later Common Lisp version that uses <A REL=DEFINITION HREF="../Body/f_endp.htm#endp"><B>ENDP</B></A>, at least for the FOR-AS-IN <P>
case. Harlequin has apparently implemented the broken semantics of <P>
&quot;X3J13/89-004 page 2-10&quot;.<P>
<P>
<P>
<B>Discussion:<P>
</B><P>
This typo has gone undetected for over two years, between January 1989 <P>
until about April 1991, when a fresh implementation of <A REL=DEFINITION HREF="../Body/m_loop.htm#loop"><B>LOOP</B></A> taken purely <P>
&quot;from the spec&quot; produced anomalous results on LOOP-FOR-AS-ON termination <P>
tests. Lawrence G. Mayka &lt;lgm@iexist.att.com&gt; noticed the variation when <P>
comparing Harlequin's <A REL=DEFINITION HREF="../Body/m_loop.htm#loop"><B>LOOP</B></A> implementation with some of the others.<P>
<P>
<P>
Jonl 11-Apr-91: I know this (the use of <A REL=DEFINITION HREF="../Body/a_atom.htm#atom"><B>ATOM</B></A> for FOR-AS-ON termination) <P>
was discussed and agreed upon; and I hope that the forum of discussion <P>
was within X3J13, either the iteration subcommittee or the whole <P>
committee. I even recall changing Lucid's implementation after this <P>
decision. [And an edit-history record of that change, along with the<P>
rationale cited above, still exists in the Lucid source code for<P>
Loop, dated 9-May-88.]<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>