131 lines
7.7 KiB
HTML
131 lines
7.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-VALUE-SETQ-ORDER 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/iss244_w.htm">
|
|
<LINK REL=UP HREF="../Issues/iss245.htm">
|
|
<LINK REL=NEXT HREF="../Issues/iss246_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/iss244_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="../Issues/iss245.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="../Issues/iss246_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
<H2>Issue MULTIPLE-VALUE-SETQ-ORDER Writeup</H2>
|
|
|
|
<PRE><B>Issue:</B> <A HREF="iss245.htm">MULTIPLE-VALUE-SETQ-ORDER</A><P>
|
|
<B>References:</B> <A REL=DEFINITION HREF="../Body/m_mult_2.htm#multiple-value-setq"><B>MULTIPLE-VALUE-SETQ</B></A>, <A REL=DEFINITION HREF="../Body/s_symbol.htm#symbol-macrolet"><B>SYMBOL-MACROLET</B></A><P>
|
|
Related issues: <A HREF="iss338.htm">SYMBOL-MACROLET-SEMANTICS</A><P>
|
|
<A HREF="iss312.htm">SETF-SUB-METHODS</A><P>
|
|
<A HREF="iss311.htm">SETF-OF-VALUES</A><P>
|
|
<B>Category:</B> CLARIFICATION<P>
|
|
<B>Edit history:</B> V1, 1 Jun 1990, Sandra Loosemore<P>
|
|
V2, 6 Jun 1990, Sandra Loosemore<P>
|
|
V3, 12 Feb 1991, Sandra Loosemore<P>
|
|
<P>
|
|
<B>Problem description:<P>
|
|
</B><P>
|
|
Proposal <A HREF="iss338.htm">SYMBOL-MACROLET-SEMANTICS:SPECIAL-FORM</A> extended<P>
|
|
<A REL=DEFINITION HREF="../Body/m_mult_2.htm#multiple-value-setq"><B>MULTIPLE-VALUE-SETQ</B></A> to allow symbols naming symbol-macros to appear in<P>
|
|
the "variables" argument to <A REL=DEFINITION HREF="../Body/m_mult_2.htm#multiple-value-setq"><B>MULTIPLE-VALUE-SETQ</B></A>. The intent was that <P>
|
|
this would be treated the same way as with <A REL=DEFINITION HREF="../Body/s_setq.htm#setq"><B>SETQ</B></A> or <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A>. However, the<P>
|
|
proposal did not address order-of-evaluation issues.<P>
|
|
<P>
|
|
When dealing only with variables, the order in which<P>
|
|
<A REL=DEFINITION HREF="../Body/m_mult_2.htm#multiple-value-setq"><B>MULTIPLE-VALUE-SETQ</B></A> performs the assignments is not relevant. On the<P>
|
|
other hand, the storing form that results from applying the<P>
|
|
<A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> <A REL=DEFINITION HREF="../Body/t_method.htm#method"><B>method</B></A> of the macroexpansion of a symbol-macro can be fully<P>
|
|
general. It might include references to other variables or "places"<P>
|
|
named by other symbol-macros in the variable list. The question is,<P>
|
|
which other variables or "places" in the list have already been set<P>
|
|
when the storing form is evaluated?<P>
|
|
<P>
|
|
For example, consider something like<P>
|
|
<P>
|
|
(<A REL=DEFINITION HREF="../Body/m_defun.htm#defun"><B>defun</B></A> foo (v i)<P>
|
|
(<A REL=DEFINITION HREF="../Body/s_symbol.htm#symbol-macrolet"><B>symbol-macrolet</B></A> ((element (<A REL=DEFINITION HREF="../Body/f_svref.htm#svref"><B>svref</B></A> v i)))<P>
|
|
(<A REL=DEFINITION HREF="../Body/m_mult_2.htm#multiple-value-setq"><B>multiple-value-setq</B></A> (v element i) ...)))<P>
|
|
<P>
|
|
Does the value corresponding to "element" get stored in the new<P>
|
|
or old value of the vector "v", at the new or old value of the index<P>
|
|
"i"?<P>
|
|
<P>
|
|
<P>
|
|
<B>Proposal (MULTIPLE-VALUE-SETQ-ORDER:LIKE-SETF-OF-VALUES):<P>
|
|
</B><P>
|
|
Clarify that<P>
|
|
<P>
|
|
(<A REL=DEFINITION HREF="../Body/m_mult_2.htm#multiple-value-setq"><B>multiple-value-setq</B></A> (<place1> ... <placen>) <value-producing-form>)<P>
|
|
<P>
|
|
is exactly equivalent to<P>
|
|
<P>
|
|
(<A REL=DEFINITION HREF="../Body/a_values.htm#values"><B>values</B></A> (<A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>setf</B></A> (<A REL=DEFINITION HREF="../Body/a_values.htm#values"><B>values</B></A> <place1> ... <placen>) <value-producing-form>))<P>
|
|
<P>
|
|
under proposal <A HREF="iss311.htm">SETF-OF-VALUES:ADD</A>, with the additional constraint that <P>
|
|
each of the <placei> must be a symbol.<P>
|
|
<P>
|
|
Rationale:<P>
|
|
<P>
|
|
Assuming <A REL=DEFINITION HREF="../Body/a_values.htm#values"><B>VALUES</B></A> is added as a <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> place, it is obvious to define<P>
|
|
of <A REL=DEFINITION HREF="../Body/m_mult_2.htm#multiple-value-setq"><B>MULTIPLE-VALUE-SETQ</B></A> (or MULTIPLE-VALUE-SETF) in terms of it.<P>
|
|
<P>
|
|
<B>Current Practice:<P>
|
|
</B><P>
|
|
Symbolics Genera 8.0 does both assignments and evaluation of place<P>
|
|
subforms in left-to-right order.<P>
|
|
Utah Common Lisp appears to do the assignments (and evaluation of <P>
|
|
place subforms) right-to-left.<P>
|
|
Chestnut's Lisp-to-C translator implements proposal <A HREF="iss311.htm">SETF-OF-VALUES</A>.<P>
|
|
<P>
|
|
<P>
|
|
<B>Cost to Implementors:<P>
|
|
</B><P>
|
|
Assuming proposal <A HREF="iss311.htm">SETF-OF-VALUES:ADD</A> is adopted, minor.<P>
|
|
<P>
|
|
<B>Cost to Users:<P>
|
|
</B><P>
|
|
Probably nobody depends on any particular behavior here, since<P>
|
|
symbol-macros are a relatively new addition to the language. This<P>
|
|
definition of <A REL=DEFINITION HREF="../Body/m_mult_2.htm#multiple-value-setq"><B>MULTIPLE-VALUE-SETQ</B></A> is fully upward-compatible with its<P>
|
|
definition in CLtL.<P>
|
|
<P>
|
|
<B>Cost of non-adoption:<P>
|
|
</B><P>
|
|
This part of the language specification remains vague.<P>
|
|
<P>
|
|
<B>Performance impact:<P>
|
|
</B><P>
|
|
The situation probably doesn't crop up enough for it to have a <P>
|
|
significant impact.<P>
|
|
<P>
|
|
<B>Benefits:<P>
|
|
</B><P>
|
|
This part of the language specification becomes less vague.<P>
|
|
<P>
|
|
<B>Esthetics:<P>
|
|
</B><P>
|
|
Any code that depends on any particular order is likely to be<P>
|
|
pretty nasty. However, defining <A REL=DEFINITION HREF="../Body/m_mult_2.htm#multiple-value-setq"><B>MULTIPLE-VALUE-SETQ</B></A> in terms of<P>
|
|
<A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> of <A REL=DEFINITION HREF="../Body/a_values.htm#values"><B>VALUES</B></A> seems like the right approach to me.<P>
|
|
<P>
|
|
<B>Discussion:<P>
|
|
</B><P>
|
|
An earlier version of this issue (with three different proposals) was<P>
|
|
discussed at the June 90 meeting.<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>
|