1
0
Fork 0
cl-sites/HyperSpec-7-0/HyperSpec/Issues/iss358_w.htm

122 lines
5.4 KiB
HTML
Raw Normal View History

2024-04-01 10:24:07 +02:00
<!-- 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 VARIABLE-LIST-ASYMMETRY 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/iss357_w.htm">
<LINK REL=UP HREF="../Issues/iss358.htm">
<LINK REL=NEXT HREF="../Issues/iss359_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/iss357_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="../Issues/iss358.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="../Issues/iss359_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
<HR>
<H2>Issue VARIABLE-LIST-ASYMMETRY Writeup</H2>
<PRE><B>Issue:</B> <A HREF="iss358.htm">VARIABLE-LIST-ASYMMETRY</A><P>
<B>References:</B> CLtL pgs. 110, 122, 131<P>
<B>Category:</B> ADDITION<P>
<B>Edit history:</B> 26-Jul-88, Version 1 by Skona Brittain<P>
04-Aug-88, Version 2 by Skona Brittain<P>
08-Oct-88, Version 3 by Pitman<P>
<P>
<B>Problem Description:<P>
</B><P>
The syntax of items in the variable-list for various control structues<P>
(do, do*, let, let*, prog, prog*, and compiler-let) varies. This<P>
variation seems unnecessary.<P>
<P>
The allowed variations are indicated in the following chart:<P>
<P>
do &amp; do*: (var) (var init) (var init step)<P>
prog &amp; prog*: var (var) (var init) n.a.<P>
let &amp; let*: var (var val) n.a.<P>
compiler-let var (var value)<P>
<P>
Note that just plain `` var '' is prohibited in do forms<P>
and that the case of ``(var)'' is prohibited in let forms<P>
and compiler-let forms.<P>
<P>
<B>Proposal (VARIABLE-LIST-ASYMMETRY:SYMMETRIZE):<P>
</B><P>
Allow all the variations in all of the forms;<P>
i.e. add the prohibited cases mentioned above.<P>
<P>
I.e. change the variable-list in the syntax descriptions as follows:<P>
<P>
do &amp; do*: ( { var | (var [init [step]] ) }* )<P>
let &amp; let*: ( { var | (var [value] ) }* )<P>
compiler-let: ( { var | (var [value] ) }* )<P>
<P>
<B>Test Cases:<P>
</B><P>
(let (a (b) (c 3)) ... ) would be valid.<P>
(let* (a (b) (c 3)) ... ) would be valid.<P>
(do (a (b) (c 3)) ... ) would be valid.<P>
(do* (a (b) (c 3)) ... ) would be valid.<P>
(compiler-let (a (b) (c 3)) ... ) would be valid.<P>
<P>
<B>Rationale:<P>
</B><P>
The asymmetry is unnecessary and impedes learning of CL.<P>
<P>
Any other way to make these cases consistent, such as either<P>
omitting just ``var'' from do &amp; do* and prog &amp; prog*, or<P>
omitting ``(var)'' from let &amp; let* and prog &amp; prog*, <P>
would be an incompatible change to the language. <P>
This way just adds the flexibility found in some of the forms to all of them.<P>
<P>
<B>Current Practice:<P>
</B><P>
KCL allows ``(var)'' in let &amp; let* but not ``var'' in do &amp; do*.<P>
<P>
Symbolics Genera allows all three cases in all the forms; i.e. it conforms<P>
to this proposal.<P>
<P>
<B>Cost to Implementors:<P>
</B><P>
Extremely slight. (May involve subtracting code rather than adding it).<P>
<P>
<B>Cost to Users:<P>
</B><P>
None.<P>
<P>
<B>Cost of Non-Adoption:<P>
</B><P>
The variation in syntax makes them harder to learn.<P>
<P>
<B>Benefits:<P>
</B><P>
Ease of learning.<P>
<P>
<B>Aesthetics:<P>
</B><P>
Symmetry is more aesthetic than asymmetry, at least to some of us.<P>
<P>
<B>Discussion: <P>
</B><P>
Pitman supports this proposal.<P>
<P>
The issue about whether the atomic ``var'' should be allowed at all in the <P>
variable lists for let &amp; let* is a separate issue. (So is whether<P>
it should mean that the var is initially bound to nil.) Since it is allowed, <P>
this proposal merely says that the alternative syntax of an atom within a <P>
list with no initial value, ``(var)'', should also be allowed.<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>