emacs.d/clones/lisp/www.cs.cmu.edu/Groups/AI/html/cltl/clm/node307.html

62 lines
4.1 KiB
HTML
Raw Normal View History

2022-08-26 19:11:35 +02:00
<!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN">
<!Converted with LaTeX2HTML 0.6.5 (Tue Nov 15 1994) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds >
<HEAD>
<TITLE>28.1.11.2. Initializing Newly Added Local Slots</TITLE>
</HEAD>
<BODY>
<meta name="description" value=" Initializing Newly Added Local Slots">
<meta name="keywords" value="clm">
<meta name="resource-type" value="document">
<meta name="distribution" value="global">
<P>
<b>Common Lisp the Language, 2nd Edition</b>
<BR> <HR><A NAME=tex2html5494 HREF="node308.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html5492 HREF="node305.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html5486 HREF="node306.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html5496 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html5497 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME=tex2html5495 HREF="node308.html"> Customizing the Change </A>
<B>Up:</B> <A NAME=tex2html5493 HREF="node305.html"> Changing the Class </A>
<B> Previous:</B> <A NAME=tex2html5487 HREF="node306.html"> Modifying the Structure </A>
<HR> <P>
<H3><A NAME=SECTION0032111200000000000000>28.1.11.2. Initializing Newly Added Local Slots</A></H3>
<P>
<img align=bottom alt="change_begin" src="gif/change_begin.gif"><br>
The second step of the update initializes the newly added slots and
performs any other user-defined actions. This step is implemented by
the generic function <tt>update-instance-for-different-class</tt>. The
generic function <tt>update-instance-for-different-class</tt> is invoked
by <tt>change-class</tt> after the first step of the update has been
completed.
<P>
The generic function <tt>update-instance-for-different-class</tt> is
invoked on two arguments computed by <tt>change-class</tt>. The first
argument passed is a copy of the instance being updated and is an
instance of the class <IMG ALIGN=BOTTOM ALT="" SRC="_24769_tex2html_wrap43651.gif">; this copy has
dynamic extent within the generic function <tt>change-class</tt>. The
second argument is the instance as updated so far by <tt>change-class</tt>
and is an instance of the class <IMG ALIGN=BOTTOM ALT="" SRC="_24769_tex2html_wrap43635.gif">.
<P>
The generic function <tt>update-instance-for-different-class</tt> also
takes any number of initialization arguments. When it is called by
<tt>change-class</tt>, no initialization arguments are provided.
<P>
There is a system-supplied primary method for the generic function
<tt>update-instance-for-different-class</tt> that has two parameter
specializers, each of which is the class <tt>standard-object</tt>. First
this method checks the validity of initialization arguments and
signals an error if an initialization argument is supplied that is not
declared valid (see section <A HREF="node294.html#DeclaringtheValidityofInitializationArgumentsSECTION">28.1.9.2</A>).
Then it calls the
generic function <tt>shared-initialize</tt> with the following arguments:
the instance, a list of names of the newly added slots, and the
initialization arguments it received.
<br><img align=bottom alt="change_end" src="gif/change_end.gif">
<P>
<BR> <HR><A NAME=tex2html5494 HREF="node308.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html5492 HREF="node305.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html5486 HREF="node306.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html5496 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html5497 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME=tex2html5495 HREF="node308.html"> Customizing the Change </A>
<B>Up:</B> <A NAME=tex2html5493 HREF="node305.html"> Changing the Class </A>
<B> Previous:</B> <A NAME=tex2html5487 HREF="node306.html"> Modifying the Structure </A>
<HR> <P>
<HR>
<P><ADDRESS>
AI.Repository@cs.cmu.edu
</ADDRESS>
</BODY>