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

129 lines
7.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 MAKE-LOAD-FORM-SAVING-SLOTS 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/iss236_w.htm">
<LINK REL=UP HREF="../Issues/iss237.htm">
<LINK REL=NEXT HREF="../Issues/iss238_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/iss236_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="../Issues/iss237.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="../Issues/iss238_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
<HR>
<H2>Issue MAKE-LOAD-FORM-SAVING-SLOTS Writeup</H2>
<PRE><B>Issue:</B> <A REL=DEFINITION HREF="../Body/f_mk_l_1.htm#make-load-form-saving-slots"><B>MAKE-LOAD-FORM-SAVING-SLOTS</B></A><P>
Reference: X3J13/92-102, dpANS 12.24<P>
<A REL=DEFINITION HREF="../Body/f_mk_ld_.htm#make-load-form"><B>MAKE-LOAD-FORM</B></A>, p.7-51<P>
<A REL=DEFINITION HREF="../Body/f_mk_l_1.htm#make-load-form-saving-slots"><B>MAKE-LOAD-FORM-SAVING-SLOTS</B></A>, p.7-56<P>
X3J13/92-2102, Kevin Gallagher comment #2<P>
X3J13/92-3104, Kim Barrett comment #4<P>
X3J13/89-526, Issue <A HREF="iss215.htm">LOAD-OBJECTS</A> (Version 4)<P>
X3J13/91-485, Issue <A HREF="iss320.htm">SLOT-VALUE-METACLASSES</A> (Version 7)<P>
<B>Category:</B> CLARIFICATION/CHANGE<P>
<B>Edit History:</B> Version 1, 1/5/93, Kim Barrett<P>
Version 2, 1/5/93, Kim Barrett (fix current practice)<P>
Version 3, 1/6/93, Kim Barrett<P>
(description is operational, move possible operators to notes)<P>
<B>Status:</B> Proposal NO-INITFORMS accepted, March 1993<P>
<P>
<B>Problem Description:<P>
</B><P>
The description of the function <A REL=DEFINITION HREF="../Body/f_mk_l_1.htm#make-load-form-saving-slots"><B>MAKE-LOAD-FORM-SAVING-SLOTS</B></A> is expressed in<P>
terms of <A REL=DEFINITION HREF="../Body/f_mk_ins.htm#make-instance"><B>MAKE-INSTANCE</B></A>, <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> of <A REL=DEFINITION HREF="../Body/f_slt_va.htm#slot-value"><B>SLOT-VALUE</B></A>, and <A REL=DEFINITION HREF="../Body/f_slt_ma.htm#slot-makunbound"><B>SLOT-MAKUNBOUND</B></A>, which is a<P>
mistake on several counts.<P>
<P>
1. It could be interpreted as indicating that slot initialization forms are<P>
to be executed, with the values of the slots then modified by <A REL=DEFINITION HREF="../Body/a_setf.htm#setf"><B>SETF</B></A> of<P>
<A REL=DEFINITION HREF="../Body/f_slt_va.htm#slot-value"><B>SLOT-VALUE</B></A> or <A REL=DEFINITION HREF="../Body/f_slt_ma.htm#slot-makunbound"><B>SLOT-MAKUNBOUND</B></A>. This is not in the spirit of the overall<P>
proposal that introduced this operator, which talks about allocation via the<P>
function <A REL=DEFINITION HREF="../Body/f_alloca.htm#allocate-instance"><B>ALLOCATE-INSTANCE</B></A>. MCL2.0 in fact used that interpretation, and then<P>
received bug reports from users who expected initforms to not be executed.<P>
<P>
2. None of these operators are defined by this document as being applicable<P>
when the metaclass <A REL=DEFINITION HREF="../Body/t_stu_cl.htm#structure-class"><B>STRUCTURE-CLASS</B></A> is involved. A sufficiently literal<P>
reading could cause one to conclude that in fact this specification requires<P>
such applicability, which the committee explicitly decided against.<P>
<P>
<B>Proposal (MAKE-LOAD-FORM-SAVING-SLOTS:NO-INITFORMS):<P>
</B><P>
1. Replace the first paragraph of the Description section of the dictionary<P>
entry for <A REL=DEFINITION HREF="../Body/f_mk_l_1.htm#make-load-form-saving-slots"><B>MAKE-LOAD-FORM-SAVING-SLOTS</B></A> with<P>
<P>
Returns \term{forms} that, when \term{evaluated}, will construct an<P>
\term{object} equivalent to \param{object}, without \term{executing}<P>
\term{initialization forms}. The \term{slots} in the new \term{object}<P>
that correspond to initialized \term{slots} in \param{object} are<P>
initialized using the values from \param{object}. Uninitialized \term{slots}<P>
in \param{object} are not initialized in the new \term{object}.<P>
\funref{make-load-form-saving-slots} works for any \term{instance} of<P>
\typeref{standard-object} or \typeref{structure-object}.<P>
<P>
2. Add the following to the Notes section for <A REL=DEFINITION HREF="../Body/f_mk_l_1.htm#make-load-form-saving-slots"><B>MAKE-LOAD-FORM-SAVING-SLOTS</B></A>.<P>
<P>
When the \term{object} is an \term{instance} of \typeref{standard-object},<P>
\funref{make-load-form-saving-slots} could return a creation form that<P>
\term{calls} \funref{allocate-instance} and an initialization form that<P>
contains \term{calls} to \macref{setf} of \funref{slot-value} and<P>
\funref{slot-makunbound}, though other \term{functions} of similar effect<P>
might actually be used.<P>
<P>
<B>Editorial Impact:<P>
</B><P>
A small cut and paste job.<P>
<P>
<B>Rationale:<P>
</B><P>
Addresses the problem description.<P>
<P>
<B>Examples:<P>
</B><P>
(<A REL=DEFINITION HREF="../Body/m_defpar.htm#defvar"><B>defvar</B></A> *initform-executed-counter* 0)<P>
(<A REL=DEFINITION HREF="../Body/m_defstr.htm#defstruct"><B>defstruct</B></A> foo<P>
(slot-1 (<A REL=DEFINITION HREF="../Body/m_incf_.htm#incf"><B>incf</B></A> *initform-executed-counter*)))<P>
(<A REL=DEFINITION HREF="../Body/m_defpar.htm#defvar"><B>defvar</B></A> *foo* (make-foo))<P>
*initform-executed-counter* =&gt; 1<P>
(<A REL=DEFINITION HREF="../Body/f_mapc_.htm#mapc"><B>mapc</B></A> #'<A REL=DEFINITION HREF="../Body/f_eval.htm#eval"><B>eval</B></A> (<A REL=DEFINITION HREF="../Body/m_mult_1.htm#multiple-value-list"><B>multiple-value-list</B></A> (<A REL=DEFINITION HREF="../Body/f_mk_l_1.htm#make-load-form-saving-slots"><B>make-load-form-saving-slots</B></A> *foo*)))<P>
*initform-executed-counter* =&gt; 1<P>
<P>
<B>Current Practice:<P>
</B><P>
Apple Macintosh Common Lisp 2.0p2 implements this.<P>
<P>
<B>Cost to Implementors:<P>
</B><P>
Probably small.<P>
<P>
<B>Cost to Users:<P>
</B><P>
Probably small. Only programs that were depending on the execution of<P>
initforms would be negatively affected by this, and such programs are<P>
probably already not portable.<P>
<P>
<B>Performance Impact:<P>
</B><P>
None.<P>
<P>
<B>Benefits:<P>
</B><P>
<B>Aesthetics:<P>
</B><P>
<B>Discussion:<P>
</B><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>