174 lines
9.9 KiB
HTML
174 lines
9.9 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-METHOD-VS-SETF-METHOD 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/iss307_w.htm">
|
|
<LINK REL=UP HREF="../Issues/iss308.htm">
|
|
<LINK REL=NEXT HREF="../Issues/iss309_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/iss307_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="../Issues/iss308.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="../Issues/iss309_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
<H2>Issue SETF-METHOD-VS-SETF-METHOD Writeup</H2>
|
|
|
|
<PRE><B>Issue:</B> <A HREF="iss308.htm">SETF-METHOD-VS-SETF-METHOD</A><P>
|
|
<B>Forum:</B> Editorial<P>
|
|
<B>References:</B> DEFINE-SETF-METHOD (CLtL, p106),<P>
|
|
GET-SETF-METHOD (CLtL, p106),<P>
|
|
GET-SETF-METHOD-MULTIPLE-VALUE (CLtL, p107),<P>
|
|
"setf method" (27.1 Glossary, page 27-27, Draft 8.81)<P>
|
|
<B>Category:</B> CHANGE<P>
|
|
<B>Edit history:</B> 08-Mar-91, Version 1 by Pitman<P>
|
|
15-Mar-91, Version 2 by Pitman (merge much discussion)<P>
|
|
08-Apr-91, Version 3 by Pitman<P>
|
|
(GET-SETF-EXPANDER => <A REL=DEFINITION HREF="../Body/f_get_se.htm#get-setf-expansion"><B>GET-SETF-EXPANSION</B></A>, per X3J13)<P>
|
|
<B>Status:</B> X3J13 passed option RENAME-OLD-TERMS on 10-3 vote, March 1991.<P>
|
|
(Note that option +ADD-ACCESSOR was not voted upon,<P>
|
|
and so it is not in effect.)<P>
|
|
<P>
|
|
<B>Problem Description:<P>
|
|
</B><P>
|
|
The terms "@bold(<A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>setf</B></A>) @italic(<A REL=DEFINITION HREF="../Body/t_method.htm#method"><B>method</B></A>)" and "@italic(<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>)"<P>
|
|
mean two different things. The former means a CLOS <A REL=DEFINITION HREF="../Body/t_method.htm#method"><B>method</B></A> defined<P>
|
|
using <A REL=DEFINITION HREF="../Body/m_defmet.htm#defmethod"><B>DEFMETHOD</B></A>, which among other things might be used by <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A>.<P>
|
|
The latter means a macro-like entity defined by <A REL=DEFINITION HREF="../Body/m_defset.htm#defsetf"><B>DEFSETF</B></A> or <P>
|
|
DEFINE-SETF-METHOD, data about which can be retrieved by<P>
|
|
GET-SETF-METHOD[-MULTIPLE-VALUE].<P>
|
|
<P>
|
|
Verbal confusion will almost surely result from the similarity of<P>
|
|
these two terms.<P>
|
|
<P>
|
|
Visual confusion will almost surely result if people don't happen to<P>
|
|
notice the font, or to realize the important distinction which it <P>
|
|
seeks to make.<P>
|
|
<P>
|
|
<B>Proposal (SETF-METHOD-VS-SETF-METHOD:RENAME-OLD-TERMS):<P>
|
|
</B><P>
|
|
Rename DEFINE-SETF-METHOD to <A REL=DEFINITION HREF="../Body/m_defi_3.htm#define-setf-expander"><B>DEFINE-SETF-EXPANDER</B></A>.<P>
|
|
Remove GET-SETF-METHOD.<P>
|
|
Rename GET-SETF-METHOD-MULTIPLE-VALUE to <A REL=DEFINITION HREF="../Body/f_get_se.htm#get-setf-expansion"><B>GET-SETF-EXPANSION</B></A>.<P>
|
|
<P>
|
|
Rename the glossary term "setf method" to "setf expander".<P>
|
|
That is, a "setf expander" is a function which tells how to<P>
|
|
store into a generalized reference.<P>
|
|
<P>
|
|
Create a glossary term "setf expansion" to refer to the five<P>
|
|
magic values returned by a "setf expander".<P>
|
|
<P>
|
|
Clarify that the glossary term "setf method" is to be synonymous<P>
|
|
with "SETF method" That is, a "setf method" is a CLOS <A REL=DEFINITION HREF="../Body/t_method.htm#method"><B>method</B></A> <P>
|
|
named (<A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> <something>).<P>
|
|
<P>
|
|
Rationale:<P>
|
|
<P>
|
|
Avoids massive terminological confusion.<P>
|
|
<P>
|
|
Simplifies the language by promoting GET-SETF-METHOD-MULITPLE-VALUE,<P>
|
|
the general purpose routine, into active duty and removing its<P>
|
|
simpleton pal GET-SETF-METHOD.<P>
|
|
<P>
|
|
<B>Proposal (SETF-METHOD-VS-SETF-METHOD:+ADD-ACCESSOR):<P>
|
|
</B><P>
|
|
Add a new function:<P>
|
|
<P>
|
|
SETF-EXPANDER-FUNCTION name <A REL=DEFINITION HREF="../Body/03_da.htm#AMoptional"><B>&OPTIONAL</B></A> environment [Function]<P>
|
|
<P>
|
|
If <name> has a <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> expander function (defined with <A REL=DEFINITION HREF="../Body/m_defset.htm#defsetf"><B>DEFSETF</B></A> or <P>
|
|
DEFINE-SETF-METHOD), and the global functional binding of <name> is<P>
|
|
not lexically shadowed within the <environment>, <P>
|
|
SETF-EXPANDER-FUNCTION returns that function. Otherwise <A REL=DEFINITION HREF="../Body/a_nil.htm#nil"><B>NIL</B></A> is <P>
|
|
returned.<P>
|
|
<P>
|
|
A <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> expander function is a function which accepts two arguments, <P>
|
|
the "place" form and an environment, and returns the five values <P>
|
|
representing the <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> expansion for that "place".<P>
|
|
<P>
|
|
<A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> may be used with SETF-EXPANDER-FUNCTION. The value must either<P>
|
|
be a <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> expander function or <A REL=DEFINITION HREF="../Body/a_nil.htm#nil"><B>NIL</B></A> (which removes any existing <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A><P>
|
|
expander function associated with the <name>). [The consequences of<P>
|
|
supplying an environment other than <A REL=DEFINITION HREF="../Body/a_nil.htm#nil"><B>NIL</B></A> when using <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> of <P>
|
|
SETF-EXPANDER-FUNCTION are not defined.]<P>
|
|
<P>
|
|
Rationale:<P>
|
|
<P>
|
|
This is symmetric with having <A REL=DEFINITION HREF="../Body/f_macro_.htm#macro-function"><B>MACRO-FUNCTION</B></A> and <P>
|
|
<A REL=DEFINITION HREF="../Body/f_cmp_ma.htm#compiler-macro-function"><B>COMPILER-MACRO-FUNCTION</B></A>.<P>
|
|
<P>
|
|
<B>Current Practice:<P>
|
|
</B><P>
|
|
Presumably no one already does this.<P>
|
|
<P>
|
|
<B>Cost to Implementors:<P>
|
|
</B><P>
|
|
RENAME-OLD-TERMS: Small. Trivial renaming of functions. <P>
|
|
Old names can be retained as an extension for compatibility<P>
|
|
if necessary to ease transition.<P>
|
|
<P>
|
|
+ADD-ACCESSOR: Probably small. Implementations have to represent<P>
|
|
this information somehow already, so this just provides access to<P>
|
|
what is already there.<P>
|
|
<P>
|
|
<B>Cost to Users:<P>
|
|
</B><P>
|
|
RENAME-OLD-TERMS:<P>
|
|
Small. It's clearly incompatible, but hopefully the motivation is strong<P>
|
|
enough that users will realize that the change is needed. A simple<P>
|
|
find-and-replace operation is likely to fix these, or compatibility names<P>
|
|
can be trivially established locally by users for code that can't easily <P>
|
|
be changed in implementations that don't already <A REL=DEFINITION HREF="../Body/f_provid.htm#provide"><B>provide</B></A> the compatibility<P>
|
|
support for old names.<P>
|
|
<P>
|
|
+ADD-ACCESSOR: None.<P>
|
|
<P>
|
|
<B>Cost of Non-Adoption:<P>
|
|
</B><P>
|
|
Risk of a `fonto' in the spec causing major havoc.<P>
|
|
Risk of implementors getting confused.<P>
|
|
Risk of confusing new users.<P>
|
|
Either some places in the spec could be harder to word unambiguously,<P>
|
|
or else glossary terms might have to be chosen which do not match<P>
|
|
function names in the language itself.<P>
|
|
<P>
|
|
<B>Benefits:<P>
|
|
</B><P>
|
|
Much easier to have casual verbal discussions.<P>
|
|
<P>
|
|
<B>Aesthetics:<P>
|
|
</B><P>
|
|
RENAME-OLD-TERMS: Major improvement in aesthetics.<P>
|
|
<P>
|
|
+ADD-ACCESSOR: Language is slightly more uniform.<P>
|
|
<P>
|
|
<B>Discussion:<P>
|
|
</B><P>
|
|
Pitman supports this proposal but is not fussy about the specific<P>
|
|
term that's used as long as it's not the status quo (`<A REL=DEFINITION HREF="../Body/t_method.htm#method"><B>method</B></A>').<P>
|
|
<P>
|
|
The terms "strategy", "technique", "macroexpander", "macro expander",<P>
|
|
"expander", and "transformer" were discussed after v1. Eric Benson, <P>
|
|
JonL, Sandra, and Pitman all seemed happy with "expander", so it <P>
|
|
v2 was changed to use that.<P>
|
|
<P>
|
|
There was also support (from Moon and Sandra) for merging <P>
|
|
GET-SETF-METHOD and GET-SETF-METHOD-MULTIPLE-VALUE back into one,<P>
|
|
so v2 added that as well.<P>
|
|
<P>
|
|
Sandra asked for SETF-EXPANDER-FUNCTION.<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>
|