124 lines
9.7 KiB
HTML
124 lines
9.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 SETF-OF-APPLY 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/iss309_w.htm">
|
|
<LINK REL=UP HREF="../Issues/iss310.htm">
|
|
<LINK REL=NEXT HREF="../Issues/iss311_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/iss309_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="../Issues/iss310.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="../Issues/iss311_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
<H2>Issue SETF-OF-APPLY Writeup</H2>
|
|
|
|
<PRE><B>Issue:</B> <A HREF="iss310.htm">SETF-OF-APPLY</A><P>
|
|
<B>References:</B> <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A><P>
|
|
Related issues: <A HREF="iss305.htm">SETF-FUNCTIONS-AGAIN</A><P>
|
|
<B>Category:</B> CLARIFICATION<P>
|
|
<B>Edit history:</B> V1, 10 May 90, Sandra Loosemore<P>
|
|
V2, 29 May 90, Sandra Loosemore (forgot <A REL=DEFINITION HREF="../Body/a_bit.htm#bit"><B>BIT</B></A> & <A REL=DEFINITION HREF="../Body/f_bt_sb.htm#sbit"><B>SBIT</B></A>)<P>
|
|
<P>
|
|
<P>
|
|
<B>Problem description:<P>
|
|
</B><P>
|
|
CLtL requires that (<A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> (<A REL=DEFINITION HREF="../Body/f_apply.htm#apply"><B>APPLY</B></A> #'foo ...)) can be used only for<P>
|
|
places "foo" whose <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> expansion is implemented in such a way that<P>
|
|
the last subform of the accessing form appears as the last<P>
|
|
argument of the storing call. The discussion and example imply that<P>
|
|
the <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> for <A REL=DEFINITION HREF="../Body/f_aref.htm#aref"><B>AREF</B></A> is required to implemented in this way. Are <P>
|
|
there any other <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> places defined in the <A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A> that are<P>
|
|
required to be usable with APPLY?<P>
|
|
<P>
|
|
This is Loosemore's issue #28.<P>
|
|
<P>
|
|
<B>Proposal (SETF-OF-APPLY:ONLY-AREF-AND-FRIENDS):<P>
|
|
</B><P>
|
|
Require that (<A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> (<A REL=DEFINITION HREF="../Body/f_apply.htm#apply"><B>APPLY</B></A> #'<place> ...) ...) work for the <A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A><P>
|
|
<place>s <A REL=DEFINITION HREF="../Body/f_aref.htm#aref"><B>AREF</B></A>, <A REL=DEFINITION HREF="../Body/a_bit.htm#bit"><B>BIT</B></A>, and <A REL=DEFINITION HREF="../Body/f_bt_sb.htm#sbit"><B>SBIT</B></A>, but document that the consequences of<P>
|
|
using any of the other <A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A> <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> <place>s with <A REL=DEFINITION HREF="../Body/f_apply.htm#apply"><B>APPLY</B></A> are<P>
|
|
undefined. <P>
|
|
<P>
|
|
This proposal does not change the behavior of (<A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> (<A REL=DEFINITION HREF="../Body/f_apply.htm#apply"><B>APPLY</B></A> ...)) <P>
|
|
with user-defined <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> methods; any <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> methods that are defined <P>
|
|
by the user in such a way that the last subform of the accessing <P>
|
|
form appears as the last argument of the storing call continue<P>
|
|
to work with <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> of <A REL=DEFINITION HREF="../Body/f_apply.htm#apply"><B>APPLY</B></A>.<P>
|
|
<P>
|
|
<B>Rationale:<P>
|
|
</B><P>
|
|
Of all the <A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A> <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> places, <A REL=DEFINITION HREF="../Body/f_aref.htm#aref"><B>AREF</B></A>, <A REL=DEFINITION HREF="../Body/a_bit.htm#bit"><B>BIT</B></A>, and <A REL=DEFINITION HREF="../Body/f_bt_sb.htm#sbit"><B>SBIT</B></A> appear to be <P>
|
|
the only functions that are defined with <A REL=DEFINITION HREF="../Body/03_da.htm#AMrest"><B>&REST</B></A> arguments and where <P>
|
|
one might have a real need to use them with <A REL=DEFINITION HREF="../Body/f_apply.htm#apply"><B>APPLY</B></A>. Not requiring <P>
|
|
(<A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> (<A REL=DEFINITION HREF="../Body/f_apply.htm#apply"><B>APPLY</B></A> #'<A REL=DEFINITION HREF="../Body/f_aref.htm#aref"><B>AREF</B></A> ...) ...) to work might be seen as an<P>
|
|
incompatible change to the language since CLtL implies that it<P>
|
|
is legitimate. <A REL=DEFINITION HREF="../Body/a_bit.htm#bit"><B>BIT</B></A> and <A REL=DEFINITION HREF="../Body/f_bt_sb.htm#sbit"><B>SBIT</B></A> are very similar to <A REL=DEFINITION HREF="../Body/f_aref.htm#aref"><B>AREF</B></A>. Requiring <P>
|
|
other <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> places to work with <A REL=DEFINITION HREF="../Body/f_apply.htm#apply"><B>APPLY</B></A> might be seen as putting <P>
|
|
unnecessary restrictions on implementors.<P>
|
|
<P>
|
|
<B>Current Practice:<P>
|
|
</B><P>
|
|
Unknown.<P>
|
|
<P>
|
|
<B>Cost to Implementors:<P>
|
|
</B><P>
|
|
Probably small. At most, you'd have to <A REL=DEFINITION HREF="../Body/f_provid.htm#provide"><B>provide</B></A> a new<P>
|
|
definition for the <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> for <A REL=DEFINITION HREF="../Body/f_aref.htm#aref"><B>AREF</B></A> and friends, or write some<P>
|
|
special-case handling for these places in the <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> for <A REL=DEFINITION HREF="../Body/f_apply.htm#apply"><B>APPLY</B></A>.<P>
|
|
<P>
|
|
<B>Cost to Users:<P>
|
|
</B><P>
|
|
Probably none. Any programs that rely on using <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> of <A REL=DEFINITION HREF="../Body/f_apply.htm#apply"><B>APPLY</B></A><P>
|
|
with other <A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A> <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> places are almost certainly<P>
|
|
nonportable anyway.<P>
|
|
<P>
|
|
<B>Cost of non-adoption:<P>
|
|
</B><P>
|
|
The language specification is unclear on this point.<P>
|
|
<P>
|
|
<B>Performance impact:<P>
|
|
</B><P>
|
|
Probably none.<P>
|
|
<P>
|
|
<B>Benefits:<P>
|
|
</B><P>
|
|
The language specification is made more clear.<P>
|
|
<P>
|
|
<B>Esthetics:<P>
|
|
</B><P>
|
|
Ugly.<P>
|
|
<P>
|
|
<B>Discussion:<P>
|
|
</B><P>
|
|
Loosemore isn't really satisfied with proposal ONLY-AREF-AND-FRIENDS.<P>
|
|
It is probably closest to the status quo, but it seems like an overly<P>
|
|
complicated and messy way of dealing with a few special cases.<P>
|
|
<P>
|
|
From a purely esthetic point of view, it would be much cleaner<P>
|
|
to <A REL=DEFINITION HREF="../Body/f_provid.htm#require"><B>require</B></A> that the <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> for <A REL=DEFINITION HREF="../Body/f_aref.htm#aref"><B>AREF</B></A> be implemented by a <P>
|
|
function (<A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> <A REL=DEFINITION HREF="../Body/f_aref.htm#aref"><B>AREF</B></A>) and then either remove the <A HREF="iss310.htm">SETF-of-APPLY</A><P>
|
|
feature completely or redefine it so that<P>
|
|
(<A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> (<A REL=DEFINITION HREF="../Body/f_apply.htm#apply"><B>APPLY</B></A> #'<name> . <args>) <value>)<P>
|
|
is equivalent to<P>
|
|
(<A REL=DEFINITION HREF="../Body/f_apply.htm#apply"><B>APPLY</B></A> #'(<A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> <name>) <value> . <args>)<P>
|
|
except for preserving the left-to-right order of evaluation of<P>
|
|
the original call. This kind of change might be seen as too much<P>
|
|
of a restriction on implementors and too major to be considered<P>
|
|
at this point, however. See issue <A HREF="iss305.htm">SETF-FUNCTIONS-AGAIN</A>.<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>
|