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

118 lines
6.7 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 MULTIPLE-VALUES-LIMIT-ON-VARIABLES 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/iss245_w.htm">
<LINK REL=UP HREF="../Issues/iss246.htm">
<LINK REL=NEXT HREF="../Issues/iss247_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/iss245_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="../Issues/iss246.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="../Issues/iss247_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
<HR>
<H2>Issue MULTIPLE-VALUES-LIMIT-ON-VARIABLES Writeup</H2>
<PRE><B>Issue:</B> <A HREF="iss246.htm">MULTIPLE-VALUES-LIMIT-ON-VARIABLES</A><P>
<B>References:</B> <A REL=DEFINITION HREF="../Body/v_multip.htm#multiple-values-limit"><B>MULTIPLE-VALUES-LIMIT</B></A>,<P>
<A REL=DEFINITION HREF="../Body/m_mult_2.htm#multiple-value-setq"><B>MULTIPLE-VALUE-SETQ</B></A>, <A REL=DEFINITION HREF="../Body/m_multip.htm#multiple-value-bind"><B>MULTIPLE-VALUE-BIND</B></A>,<P>
<A REL=DEFINITION HREF="../Body/m_nth_va.htm#nth-value"><B>NTH-VALUE</B></A><P>
Related issues: none<P>
<B>Category:</B> CLARIFICATION<P>
<B>Edit history:</B> v1, 13 Feb 1991, Sandra Loosemore<P>
<P>
<B>Problem description:<P>
</B><P>
The constant <A REL=DEFINITION HREF="../Body/v_multip.htm#multiple-values-limit"><B>MULTIPLE-VALUES-LIMIT</B></A> is defined in CLtL as the upper<P>
exclusive bound on the number of values that may be returned from<P>
a function. Does this limit also apply to the number of variables<P>
that may be bound or assigned by <A REL=DEFINITION HREF="../Body/m_multip.htm#multiple-value-bind"><B>MULTIPLE-VALUE-BIND</B></A> or <P>
MULTIPLE-VALUE-SETQ? Or are the excess variables simply given values<P>
of NIL?<P>
<P>
There are two proposals, UNDEFINED and <A REL=DEFINITION HREF="../Body/a_nil.htm#nil"><B>NIL</B></A>.<P>
<P>
<B>Proposal (MULTIPLE-VALUES-LIMIT-ON-VARIABLES:UNDEFINED):<P>
</B><P>
Clarify that <A REL=DEFINITION HREF="../Body/v_multip.htm#multiple-values-limit"><B>MULTIPLE-VALUES-LIMIT</B></A> applies to the number of variables<P>
that may be bound or assigned by <A REL=DEFINITION HREF="../Body/m_multip.htm#multiple-value-bind"><B>MULTIPLE-VALUE-BIND</B></A> or <P>
<A REL=DEFINITION HREF="../Body/m_mult_2.htm#multiple-value-setq"><B>MULTIPLE-VALUE-SETQ</B></A> and the index argument to <A REL=DEFINITION HREF="../Body/m_nth_va.htm#nth-value"><B>NTH-VALUE</B></A>, as well <P>
as to the number values that can actually be returned.<P>
<P>
Rationale:<P>
<P>
It's conceivable that these forms for accessing multiple values <P>
could be implemented in such a way that they break if you try to<P>
access values beyond <A REL=DEFINITION HREF="../Body/v_multip.htm#multiple-values-limit"><B>MULTIPLE-VALUES-LIMIT</B></A>.<P>
<P>
<P>
<B>Proposal (MULTIPLE-VALUES-LIMIT-ON-VARIABLES:NIL):<P>
</B><P>
Clarify that <A REL=DEFINITION HREF="../Body/v_multip.htm#multiple-values-limit"><B>MULTIPLE-VALUES-LIMIT</B></A> applies only to the number of values<P>
that can actually be returned, and not to the number of variables that<P>
may be bound or assigned by <A REL=DEFINITION HREF="../Body/m_multip.htm#multiple-value-bind"><B>MULTIPLE-VALUE-BIND</B></A> or <A REL=DEFINITION HREF="../Body/m_mult_2.htm#multiple-value-setq"><B>MULTIPLE-VALUE-SETQ</B></A><P>
or the index argument to <A REL=DEFINITION HREF="../Body/m_nth_va.htm#nth-value"><B>NTH-VALUE</B></A>. As usual, <A REL=DEFINITION HREF="../Body/a_nil.htm#nil"><B>NIL</B></A> if there are not<P>
enough values actually returned.<P>
<P>
Rationale:<P>
<P>
There are ways of implementing these forms for accessing multiple<P>
values in such a way that they don't break if you try to access<P>
values beyond <A REL=DEFINITION HREF="../Body/v_multip.htm#multiple-values-limit"><B>MULTIPLE-VALUES-LIMIT</B></A>.<P>
<P>
<B>Current Practice:<P>
</B><P>
I don't know.<P>
<P>
<B>Cost to Implementors:<P>
</B><P>
For proposal UNDEFINED, none.<P>
For proposal <A REL=DEFINITION HREF="../Body/a_nil.htm#nil"><B>NIL</B></A>, more care needs to be taken in implementing multiple<P>
values.<P>
<P>
<B>Cost to Users:<P>
</B><P>
For proposal <A REL=DEFINITION HREF="../Body/a_nil.htm#nil"><B>NIL</B></A>, none.<P>
For proposal UNDEFINED, loss of portability for some programs (probably<P>
very rare).<P>
<P>
<B>Cost of non-adoption:<P>
</B><P>
Confusion about what implementation techniques for multiple values are<P>
valid.<P>
<P>
<B>Performance impact:<P>
</B><P>
Hard to say.<P>
<P>
<B>Benefits:<P>
</B><P>
The cost of non-adoption is avoided.<P>
<P>
<B>Esthetics:<P>
</B><P>
Proposal <A REL=DEFINITION HREF="../Body/a_nil.htm#nil"><B>NIL</B></A> is probably better from a purely theoretical point of view,<P>
since it doesn't complicate the language by imposing arbitrary limits<P>
on programs.<P>
<P>
<B>Discussion:<P>
</B><P>
Loosemore prefers proposal <A REL=DEFINITION HREF="../Body/a_nil.htm#nil"><B>NIL</B></A>, as long as it doesn't cause problems<P>
for implementors.<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>