262 lines
13 KiB
HTML
262 lines
13 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-MISCELLANEOUS-REPAIRS 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/iss222_w.htm">
|
|
<LINK REL=UP HREF="../Issues/iss223.htm">
|
|
<LINK REL=NEXT HREF="../Issues/iss224_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/iss222_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="../Issues/iss223.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="../Issues/iss224_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
<H2>Issue LOOP-MISCELLANEOUS-REPAIRS Writeup</H2>
|
|
|
|
<PRE><B>Issue:</B> <A HREF="iss223.htm">LOOP-MISCELLANEOUS-REPAIRS</A><P>
|
|
Document: (no document number yet)<P>
|
|
<B>Forum:</B> Cleanup<P>
|
|
<B>References:</B> refer to the referenced Public Review comments<P>
|
|
<B>Category:</B> CLARIFICATION<P>
|
|
<B>Edit history:</B> 14-Feb-93, Version 1 by Moon<P>
|
|
18-Feb-93, Version 2 by Moon (fix spelling error)<P>
|
|
<B>Status:</B> Proposal FIX passed 7-1-0, March 1993<P>
|
|
<P>
|
|
<B>Problem Description:<P>
|
|
</B><P>
|
|
There were public review comments relating to chapter 6 of draft 12.24.<P>
|
|
This cleanup does not address the complete set, just the easier ones<P>
|
|
since it makes sense to lump them all into one omnibus issue. I have<P>
|
|
not included editorial comments in this cleanup.<P>
|
|
<P>
|
|
A brief summary of the comments:<P>
|
|
<P>
|
|
1. Flanagan #4, Loosemore #3, Moon #47 -- extension mechanism is<P>
|
|
promised but not included<P>
|
|
<P>
|
|
2. Moon #28 -- text says "Function Designator", examples work differently<P>
|
|
<P>
|
|
3. Moon #30 -- <A REL=DEFINITION HREF="../Body/m_loop.htm#loop"><B>LOOP</B></A> "IT" Description doesn't make sense<P>
|
|
<P>
|
|
4. Moon #32 -- <A REL=DEFINITION HREF="../Body/m_loop.htm#loop"><B>LOOP</B></A> DOING doesn't allow implicit <A REL=DEFINITION HREF="../Body/s_progn.htm#progn"><B>progn</B></A>, but <A REL=DEFINITION HREF="../Body/m_do_do.htm#do"><B>DO</B></A> does<P>
|
|
<P>
|
|
5. Moon #35 -- <A REL=DEFINITION HREF="../Body/m_loop_f.htm#loop-finish"><B>LOOP-FINISH</B></A> Inconsistency<P>
|
|
<P>
|
|
6. Moon #37 -- Does <A REL=DEFINITION HREF="../Body/m_loop.htm#loop"><B>LOOP</B></A> <A REL=DEFINITION HREF="../Body/m_return.htm#return"><B>RETURN</B></A> clause return multiple values?<P>
|
|
<P>
|
|
7. Moon #41 -- <A REL=DEFINITION HREF="../Body/m_loop.htm#loop"><B>LOOP</B></A> Conditional Execution Nonsense<P>
|
|
<P>
|
|
8. Moon #43 -- <A REL=DEFINITION HREF="../Body/m_loop.htm#loop"><B>LOOP</B></A> Bad Type-Spec Example<P>
|
|
<P>
|
|
9. Moon #21 -- <A REL=DEFINITION HREF="../Body/m_loop.htm#loop"><B>LOOP</B></A> Block Name Scope is not specified<P>
|
|
<P>
|
|
10. Moon #34 -- <A REL=DEFINITION HREF="../Body/m_loop.htm#loop"><B>LOOP</B></A> Thereis Default is not specified<P>
|
|
<P>
|
|
11. Moon #24 -- <A HREF="iss220.htm">LOOP-AND-DISCREPANCY:NO-REITERATION</A> not incorporated<P>
|
|
<P>
|
|
12. Moon #25 -- <A REL=DEFINITION HREF="../Body/m_loop.htm#loop"><B>LOOP</B></A> by/to phrase Order should be unrestricted<P>
|
|
<P>
|
|
13. Moon #36 -- <A REL=DEFINITION HREF="../Body/m_loop.htm#loop"><B>LOOP</B></A> Return/Named Interaction<P>
|
|
<P>
|
|
14. Moon #26 -- Eliminate the ability to put a <A REL=DEFINITION HREF="../Body/m_loop.htm#loop"><B>LOOP</B></A> keyword after FINALLY<P>
|
|
<P>
|
|
Proposal (<A HREF="iss223.htm">LOOP-MISCELLANEOUS-REPAIRS:FIX</A>)<P>
|
|
<P>
|
|
Make all of the following numbered changes:<P>
|
|
<P>
|
|
1. Remove reference to extension mechanism on page 6-32.<P>
|
|
<P>
|
|
2. Change definition of step-fun on page 6-5 to:<P>
|
|
<P>
|
|
\param{step-fun}---a \term{form} that evaluates to a \term{function}<P>
|
|
of one \term{argument}.<P>
|
|
<P>
|
|
3. Replace the entire paragraph beginning "clause, clause1" on page 6-5<P>
|
|
with:<P>
|
|
<P>
|
|
\param{Clause}, \param{clause1}, \param{clause2} -- <P>
|
|
\i{unconditional} | \i{accumulation} | \i{conditional}, as defined<P>
|
|
in the section "Syntax of an Extended <A REL=DEFINITION HREF="../Body/m_loop.htm#loop"><B>LOOP</B></A> Form".<P>
|
|
<P>
|
|
Replace the last paragraph on page 6-18 with: <P>
|
|
<P>
|
|
The \term{loop keyword} \loopref{it} can be used to refer to the result<P>
|
|
of the test expression in a clause.<P>
|
|
Use the \term{loop keyword} \loopref{it} in place of the form in a<P>
|
|
{\tt return} clause or an \i{accumulation} clause that is<P>
|
|
inside a conditional execution clause.<P>
|
|
If multiple clauses are connected with \loopref{and}, the \loopref{it}<P>
|
|
construct must be in the first clause in the block.<P>
|
|
<P>
|
|
In a Notes section, note that:<P>
|
|
<P>
|
|
Use caution when using a variable named {\tt it} (in any package) in<P>
|
|
connection with <A REL=DEFINITION HREF="../Body/m_loop.htm#loop"><B>LOOP</B></A>, since \loopref{it} is a \term{loop keyword} that<P>
|
|
can be used in place of a form in certain contexts.<P>
|
|
<P>
|
|
4. Add DOING to the next-to-last paragraph on page 6-5.<P>
|
|
<P>
|
|
5. Remove the following paragraph from p.6-7:<P>
|
|
<P>
|
|
Note also that the \macref{loop-finish} macro terminates iteration and<P>
|
|
returns any accumulated result. Any \loopref{finally} clauses that are<P>
|
|
supplied are evaluated.<P>
|
|
<P>
|
|
6. Change the next-to-last paragraph on p.6-7, the third paragraph on<P>
|
|
p.6-19, and the last paragraph on p.6-19 all to state clearly that all<P>
|
|
values returned by the form in a <A REL=DEFINITION HREF="../Body/m_return.htm#return"><B>RETURN</B></A> clause are returned by the <A REL=DEFINITION HREF="../Body/m_loop.htm#loop"><B>LOOP</B></A>.<P>
|
|
<P>
|
|
7. Replace the first three paragraphs under the heading Conditional<P>
|
|
Execution on p.6-18 with:<P>
|
|
<P>
|
|
The \loopref{if}, \loopref{when}, and \loopref{unless} constructs<P>
|
|
establish conditional control in a \macref{loop}. If the test<P>
|
|
passes, the succeeding loop clause is executed. If the test does<P>
|
|
not pass, the succeeding clause is skipped, and program control<P>
|
|
moves to the clause that follows the \term{loop keyword}<P>
|
|
\loopref{else}. If the test does not pass and no \loopref{else}<P>
|
|
clause is supplied, control is transferred to the clause or<P>
|
|
construct following the entire conditional clause.<P>
|
|
<P>
|
|
If conditional clauses are nested, each \loopref{else} is paired<P>
|
|
with the closest preceding conditional clause that has no<P>
|
|
associated \loopref{else} or \loopref{end}. <P>
|
|
<P>
|
|
In the \loopref{if} and \loopref{when} clauses, which are<P>
|
|
synonymous, the test passes if the value of \param{form} is<P>
|
|
\term{true}. <P>
|
|
<P>
|
|
The \loopref{unless} \param{form} construct is equivalent to<P>
|
|
\f{when (not \param{form})}; the test passes if the value of<P>
|
|
\param{form} is \term{false}.<P>
|
|
<P>
|
|
8. Add OF-TYPE to the example on page 6-24.<P>
|
|
<P>
|
|
9. State explicitly in the next to last paragraph on page 6-19 that the<P>
|
|
scope of the block name includes the entire <A REL=DEFINITION HREF="../Body/m_loop.htm#loop"><B>LOOP</B></A>. Move the "BLOCK NIL"<P>
|
|
in the example on page 6-17 so it is outside the <A REL=DEFINITION HREF="../Body/s_let_l.htm#letST"><B>LET*</B></A>.<P>
|
|
<P>
|
|
10. Add the following sentence to the description of "thereis" in the<P>
|
|
section "Termination Condition Clauses" on p.6-7:<P>
|
|
<P>
|
|
Otherwise, it provides a default return value of \nil.<P>
|
|
<P>
|
|
11. Make the syntax and the English agree with the X3J13 vote on<P>
|
|
<A HREF="iss220.htm">LOOP-AND-DISCREPANCY:NO-REITERATION</A> (Version 1) by correcting<P>
|
|
the syntax for each for-as subclause on page 6-3 by removing<P>
|
|
the "\curly{\loopref{for} | \loopref{as}}"; by adding the<P>
|
|
same text to the front of the definition of for-as-clause on<P>
|
|
page 6-3; and by adding a sentence to the second paragraph on<P>
|
|
page 6-9 clarifying that the word FOR or AS is not repeated<P>
|
|
after the word <A REL=DEFINITION HREF="../Body/a_and.htm#and"><B>AND</B></A>.<P>
|
|
<P>
|
|
12. The detailed description of for-as-arithmetic (p6-9) should say<P>
|
|
in English that the "by" subclause can appear either before or after<P>
|
|
the "to" subclause, and similarly for the other two pairs of<P>
|
|
subclauses. The syntax of for-as-arithmetic on p.6-3 should be<P>
|
|
changed as follows, to allow the three subclauses to appear in any<P>
|
|
order, to <A REL=DEFINITION HREF="../Body/f_provid.htm#require"><B>require</B></A> at least one subclause to be used, and to indicate<P>
|
|
the restrictions on combinations of prepositions described in<P>
|
|
English on pp.6-9..6-10:<P>
|
|
<P>
|
|
for-as-arithmetic ::= { FOR | AS } var [ type-spec ]<P>
|
|
{ { FROM | UPFROM } form1 [ { TO | UPTO | BELOW } form2 ] [ BY form3 ] <P>
|
|
|<P>
|
|
{ FROM | UPFROM } form1 BY form3 [ { TO | UPTO | BELOW } form2 ] |<P>
|
|
{ TO | UPTO | BELOW } form2 [ { FROM | UPFROM } form1 ] [ BY form3 ] <P>
|
|
|<P>
|
|
{ TO | UPTO | BELOW } form2 BY form3 [ { FROM | UPFROM } form1 ] |<P>
|
|
BY form3 [ { FROM | UPFROM } form1 ] [ { TO | UPTO | BELOW } form2 ] <P>
|
|
|<P>
|
|
BY form3 { TO | UPTO | BELOW } form2 [ { FROM | UPFROM } form1 ] |<P>
|
|
FROM form1 { DOWNTO | ABOVE } form2 [ BY form3 ] |<P>
|
|
FROM form1 BY form3 { DOWNTO | ABOVE } form2 |<P>
|
|
{ DOWNTO | ABOVE } form2 FROM form1 [ BY form3 ] |<P>
|
|
{ DOWNTO | ABOVE } form2 BY form3 FROM form1 |<P>
|
|
BY form3 { DOWNTO | ABOVE } form2 FROM form1 |<P>
|
|
BY form3 FROM form1 { DOWNTO | ABOVE } form2 |<P>
|
|
DOWNFROM form1 [ { TO | DOWNTO | ABOVE } form2 ] [ BY form3 ] |<P>
|
|
DOWNFROM form1 BY form3 [ { TO | DOWNTO | ABOVE } form2 ] |<P>
|
|
{ TO | DOWNTO | ABOVE } form2 DOWNFROM form1 [ BY form3 ] |<P>
|
|
{ TO | DOWNTO | ABOVE } form2 BY form3 DOWNFROM form1 |<P>
|
|
BY form3 [ { TO | DOWNTO | ABOVE } form2 ] DOWNFROM form1 |<P>
|
|
BY form3 DOWNFROM form1 [ { TO | DOWNTO | ABOVE } form2 ]<P>
|
|
}<P>
|
|
<P>
|
|
Yes, it looks complicated, that's the limitation of BNF to express<P>
|
|
things where not all permutations are allowed.<P>
|
|
<P>
|
|
13. Replace the second sentence of the next-to-last paragraph on page 6-7<P>
|
|
with:<P>
|
|
<P>
|
|
It is equivalent to the clause<P>
|
|
\f{do (<A REL=DEFINITION HREF="../Body/s_ret_fr.htm#return-from"><B>return-from</B></A> \i{block-name} \i{value})},<P>
|
|
where \i{block-name} is the name specified in a \loopref{named}<P>
|
|
clause, or \nil if there is no \loopref{named} clause.<P>
|
|
<P>
|
|
Replace the second sentence of the third paragraph on page 6-19<P>
|
|
with the text quoted just above.<P>
|
|
<P>
|
|
14. Remove the syntax "finally unconditional-clause" on page 6-4. Remove<P>
|
|
the sentence "An unconditional clause can also follow <P>
|
|
\theloopkeyword{finally}." from the sixth paragraph on page 6-8.<P>
|
|
<P>
|
|
<B>Test Cases:<P>
|
|
</B><P>
|
|
Refer to the referenced Public Review comments<P>
|
|
<P>
|
|
<B>Rationale:<P>
|
|
</B><P>
|
|
These are non-controversial corrections to mistakes or ambiguities in<P>
|
|
the draft specification.<P>
|
|
<P>
|
|
<B>Current Practice:<P>
|
|
</B><P>
|
|
All of these changes bring the specification into conformity with current<P>
|
|
practice as observed in Apple MCL 2.0p1, with the exception of the ability<P>
|
|
to put the BY subclause before both of the other subclauses in #12. I<P>
|
|
believe it would be a one-line change to the implementation to allow that.<P>
|
|
<P>
|
|
<B>Cost to Implementors:<P>
|
|
</B><P>
|
|
Little or none for most implementations that already conform.<P>
|
|
<P>
|
|
<B>Cost to Users:<P>
|
|
</B><P>
|
|
Probably none.<P>
|
|
<P>
|
|
<B>Cost of Non-Adoption:<P>
|
|
</B><P>
|
|
Ambiguous, inconsistent, or incomprehensible language specification.<P>
|
|
<P>
|
|
<B>Benefits:<P>
|
|
</B><P>
|
|
Better language specification.<P>
|
|
<P>
|
|
<B>Aesthetics:<P>
|
|
</B><P>
|
|
Better language specification.<P>
|
|
<P>
|
|
<B>Performance Impact:<P>
|
|
</B><P>
|
|
None.<P>
|
|
<P>
|
|
<B>Discussion:<P>
|
|
</B><P>
|
|
None.<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>
|