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

125 lines
9.1 KiB
HTML
Raw Permalink 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 SETF-FUNCTIONS-AGAIN 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/iss304_w.htm">
<LINK REL=UP HREF="../Issues/iss305.htm">
<LINK REL=NEXT HREF="../Issues/iss306_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/iss304_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="../Issues/iss305.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="../Issues/iss306_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
<HR>
<H2>Issue SETF-FUNCTIONS-AGAIN Writeup</H2>
<PRE><B>Issue:</B> <A HREF="iss305.htm">SETF-FUNCTIONS-AGAIN</A><P>
<B>References:</B> <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A>, <A REL=DEFINITION HREF="../Body/f_fbound.htm#fboundp"><B>FBOUNDP</B></A>, <A REL=DEFINITION HREF="../Body/f_fdefin.htm#fdefinition"><B>FDEFINITION</B></A>, <A REL=DEFINITION HREF="../Body/m_defstr.htm#defstruct"><B>DEFSTRUCT</B></A><P>
Related issues: Issue <A HREF="iss174.htm">FUNCTION-NAME</A><P>
Issue <A HREF="iss310.htm">SETF-OF-APPLY</A><P>
<B>Category:</B> CLARIFICATION<P>
<B>Edit history:</B> V1, 13 May 90, Sandra Loosemore<P>
<P>
<B>Problem description:<P>
</B><P>
The addition of <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> functions to the language has left some<P>
lingering questions:<P>
<P>
- Whether (<A REL=DEFINITION HREF="../Body/f_fbound.htm#fboundp"><B>FBOUNDP</B></A> '(<A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> &lt;name&gt;)) is supposed to be true of &lt;name&gt;s <P>
that have <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> methods (as defined with <A REL=DEFINITION HREF="../Body/m_defset.htm#defsetf"><B>DEFSETF</B></A> or DEFINE-SETF-METHOD)<P>
defined, or only &lt;name&gt;s where there are globally defined<P>
functions named (<A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> &lt;name&gt;). (Issue #17 from Loosemore's<P>
list.)<P>
<P>
- Whether <A REL=DEFINITION HREF="../Body/m_defstr.htm#defstruct"><B>DEFSTRUCT</B></A> is required to generate <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> functions, or required<P>
to generate <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> methods, or whether this is unspecified. (Issue<P>
#19)<P>
<P>
- Whether <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> are required to be<P>
implemented by <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> functions, by <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> methods, or whether this<P>
is unspecified. (Issue #20)<P>
<P>
- Whether it is permissible for a &lt;name&gt; to have both a <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A><P>
<A REL=DEFINITION HREF="../Body/t_method.htm#method"><B>method</B></A> defined via <A REL=DEFINITION HREF="../Body/m_defset.htm#defsetf"><B>DEFSETF</B></A> or DEFINE-SETF-METHOD, and an associated<P>
<A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> function at the same time. <P>
<P>
<P>
<B>Proposal (SETF-FUNCTIONS-AGAIN:MINIMAL-CHANGES):<P>
</B><P>
(1) Clarify that (<A REL=DEFINITION HREF="../Body/f_fbound.htm#fboundp"><B>FBOUNDP</B></A> '(<A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> &lt;name&gt;)) must return true if and<P>
only if there is a function named (<A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> &lt;name&gt;) defined. It must<P>
return <A REL=DEFINITION HREF="../Body/a_nil.htm#nil"><B>NIL</B></A> if &lt;name&gt; has a <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> defined but not a <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A><P>
function.<P>
<P>
(2) Clarify that it is unspecified whether <A REL=DEFINITION HREF="../Body/m_defstr.htm#defstruct"><B>DEFSTRUCT</B></A> generates<P>
<A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> methods or <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> functions for non-:READ-ONLY slot accessors.<P>
<P>
(3) Clarify that, unless a <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> function is explicitly documented<P>
in the <A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A>, it is unspecified whether <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> places defined in<P>
the <A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A> must be implemented as <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> methods or <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> functions.<P>
In combination with item (1), this implies that it is unspecified<P>
whether (<A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> &lt;name&gt;) is <A REL=DEFINITION HREF="../Body/f_fbound.htm#fboundp"><B>FBOUNDP</B></A> for these <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><P>
places.<P>
<P>
(4) Clarify that it is possible, but generally not very useful, <P>
to have both a <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> and a <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> function defined for the same<P>
name.<P>
<P>
<B>Rationale:<P>
</B><P>
This proposal requires minimal changes for implementors.<P>
<P>
<B>Current Practice:<P>
</B><P>
Most implementations use <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> methods (and not <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> functions)<P>
to implement <A REL=DEFINITION HREF="../Body/m_defstr.htm#defstruct"><B>DEFSTRUCT</B></A> accessors and 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.<P>
In most implementations, the namespaces for <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> methods and<P>
<A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> functions are disjoint.<P>
<P>
<B>Cost to Implementors:<P>
</B><P>
Probably none.<P>
<P>
<B>Cost to Users:<P>
</B><P>
Probably none.<P>
<P>
<B>Cost of non-adoption:<P>
</B><P>
Imprecision in the language specification.<P>
<P>
<B>Performance impact:<P>
</B><P>
Probably not significant.<P>
<P>
<B>Benefits:<P>
</B><P>
The language specification is made more precise.<P>
<P>
<B>Esthetics:<P>
</B><P>
It would probably be better to specify whether <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><P>
places must be implemented as <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> functions or as <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A><P>
methods, instead of leaving it explicitly vague. See also<P>
issue <A HREF="iss310.htm">SETF-OF-APPLY</A> for one particular case (<A REL=DEFINITION HREF="../Body/f_aref.htm#aref"><B>AREF</B></A>) where it<P>
seems like a good idea to specify that the <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> place must be<P>
implemented as a <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> function.<P>
<P>
<B>Discussion:<P>
</B></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>