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

125 lines
8.1 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 CHANGE-CLASS-INITARGS 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/iss022_w.htm">
<LINK REL=UP HREF="../Issues/iss023.htm">
<LINK REL=NEXT HREF="../Issues/iss024_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/iss022_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="../Issues/iss023.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="../Issues/iss024_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
<HR>
<H2>Issue CHANGE-CLASS-INITARGS Writeup</H2>
<PRE><B>Issue:</B> <A HREF="iss023.htm">CHANGE-CLASS-INITARGS</A><P>
Reference: X3J13/92-102, dpANS 12.24<P>
<A REL=DEFINITION HREF="../Body/f_chg_cl.htm#change-class"><B>CHANGE-CLASS</B></A> (p.7-38)<P>
<A REL=DEFINITION HREF="../Body/f_update.htm#update-instance-for-different-class"><B>UPDATE-INSTANCE-FOR-DIFFERENT-CLASS</B></A> (p.7-34)<P>
<A REL=DEFINITION HREF="../Body/f_mk_ins.htm#make-instance"><B>MAKE-INSTANCE</B></A> (p.7-50)<P>
Section 7.1.2 Declaring the Validity of Initialization<P>
Arguments (p.7.2)<P>
Section 7.2.2 Initializing Newly Added Local Slots (p.7-9)<P>
X3J13/92-2513, Kim Barrett comment #13<P>
AMOP (p.33, p.310)<P>
<B>Category:</B> Change<P>
<B>Edit History:</B> Version 1, 8/31/91, Kim Barrett<P>
Version 2, 9/6/91, Kim Barrett (Moon's comments)<P>
Version 3, 1/7/93, Kim Barrett (update references)<P>
<B>Status:</B> Proposal PERMIT passed 7-1, March 1993<P>
<P>
<B>Problem Description:<P>
</B><P>
Because <A REL=DEFINITION HREF="../Body/f_chg_cl.htm#change-class"><B>CHANGE-CLASS</B></A> does not accept initargs, certain kinds of instance<P>
updates must now go through a two-step process of first calling <A REL=DEFINITION HREF="../Body/f_chg_cl.htm#change-class"><B>CHANGE-CLASS</B></A><P>
and then calling <A REL=DEFINITION HREF="../Body/f_reinit.htm#reinitialize-instance"><B>REINITIALIZE-INSTANCE</B></A>. If <A REL=DEFINITION HREF="../Body/f_chg_cl.htm#change-class"><B>CHANGE-CLASS</B></A> accepted initargs,<P>
the explicit reinitialization step would be unnecessary.<P>
<P>
<B>Proposal (CHANGE-CLASS-INITARGS:PERMIT):<P>
</B><P>
1. Change the syntax for <A REL=DEFINITION HREF="../Body/f_chg_cl.htm#change-class"><B>CHANGE-CLASS</B></A> to<P>
<P>
<A REL=DEFINITION HREF="../Body/f_chg_cl.htm#change-class"><B>CHANGE-CLASS</B></A> instance new-class &amp;key &amp;allow-other-keys<P>
<P>
and modify the two <A REL=DEFINITION HREF="../Body/t_method.htm#method"><B>method</B></A> signatures currently specified accordingly:<P>
<P>
<A REL=DEFINITION HREF="../Body/f_chg_cl.htm#change-class"><B>CHANGE-CLASS</B></A><P>
(instance <A REL=DEFINITION HREF="../Body/t_std_ob.htm#standard-object"><B>standard-object</B></A>) (new-class <A REL=DEFINITION HREF="../Body/t_std_cl.htm#standard-class"><B>standard-class</B></A>) &amp;rest initargs<P>
<P>
<A REL=DEFINITION HREF="../Body/f_chg_cl.htm#change-class"><B>CHANGE-CLASS</B></A> (instance t) (new-class symbol) &amp;rest initargs<P>
<P>
with the initargs parameter described in the same way as the corresponding<P>
parameter to <A REL=DEFINITION HREF="../Body/f_update.htm#update-instance-for-different-class"><B>UPDATE-INSTANCE-FOR-DIFFERENT-CLASS</B></A>.<P>
<P>
2. Change the last paragraph of the description of <A REL=DEFINITION HREF="../Body/f_chg_cl.htm#change-class"><B>CHANGE-CLASS</B></A> to include<P>
the initargs in the arguments passed to the reinvocation, by adding the<P>
phrase &quot;and the \param{initargs}&quot; to the end of the last sentence.<P>
<P>
3. Change the description of the process by which newly added local slots are<P>
initialized to specify that <A REL=DEFINITION HREF="../Body/f_chg_cl.htm#change-class"><B>CHANGE-CLASS</B></A> also passes the initargs to<P>
<A REL=DEFINITION HREF="../Body/f_update.htm#update-instance-for-different-class"><B>UPDATE-INSTANCE-FOR-DIFFERENT-CLASS</B></A>. This involves adding mention of the<P>
initargs to the 2nd paragraph of &quot;Initializing Newly Added Local Slots&quot; and<P>
striking the 3rd paragraph.<P>
<P>
<B>Editorial Impact:<P>
</B><P>
Several small changes to one function description and one small concept<P>
section. <P>
<P>
<B>Rationale:<P>
</B><P>
Makes <A REL=DEFINITION HREF="../Body/f_chg_cl.htm#change-class"><B>CHANGE-CLASS</B></A> more consistant with other parts of the various<P>
initialization protocols, and removes the need for a somewhat awkward idiom.<P>
<P>
<B>Current Practice:<P>
</B><P>
Lucid 4.0 and Apple MCL 2.0p2 appear to follow the current specification,<P>
with <A REL=DEFINITION HREF="../Body/f_chg_cl.htm#change-class"><B>CHANGE-CLASS</B></A> not accepting initargs.<P>
<P>
Chestnut's Lisp-to-C translator contains a compile-time switch that permits<P>
the user to select whether <A REL=DEFINITION HREF="../Body/f_chg_cl.htm#change-class"><B>CHANGE-CLASS</B></A> accepts initargs or not.<P>
<P>
<B>Cost to Implementors:<P>
</B><P>
The generic function definition and any methods on <A REL=DEFINITION HREF="../Body/f_chg_cl.htm#change-class"><B>CHANGE-CLASS</B></A> would need to<P>
be changed to deal with the initargs. Implementors might want to change some<P>
places that might currently call <A REL=DEFINITION HREF="../Body/f_chg_cl.htm#change-class"><B>CHANGE-CLASS</B></A> followed by<P>
<A REL=DEFINITION HREF="../Body/f_reinit.htm#reinitialize-instance"><B>REINITIALIZE-INSTANCE</B></A> to just call <A REL=DEFINITION HREF="../Body/f_chg_cl.htm#change-class"><B>CHANGE-CLASS</B></A> with initargs, and this might<P>
<A REL=DEFINITION HREF="../Body/f_provid.htm#require"><B>require</B></A> some other changes as well. The number of occurances of <A REL=DEFINITION HREF="../Body/f_chg_cl.htm#change-class"><B>CHANGE-CLASS</B></A><P>
is likely small, so it probably isn't too difficult.<P>
<P>
<B>Cost to Users:<P>
</B><P>
Similar to the cost to implementors. However, users of multiple<P>
implementations will also have to deal with the different rates at which<P>
vendors incorporate this change.<P>
<P>
<B>Performance Impact:<P>
</B><P>
None.<P>
<P>
<B>Aesthetics:<P>
</B><P>
Eliminating the need for an awkward idiom is an improvement.<P>
<P>
<B>Discussion:<P>
</B><P>
This issue was raised informally some time ago by Gregor and others, but it<P>
appears that no formal proposal was ever made.<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>