93 lines
5.6 KiB
HTML
93 lines
5.6 KiB
HTML
<!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.10. Redefining Classes</TITLE>
|
|
</HEAD>
|
|
<BODY>
|
|
<meta name="description" value=" Redefining Classes">
|
|
<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=tex2html5405 HREF="node301.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html5403 HREF="node261.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html5397 HREF="node299.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html5407 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html5408 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
|
|
<B> Next:</B> <A NAME=tex2html5406 HREF="node301.html"> Modifying the Structure </A>
|
|
<B>Up:</B> <A NAME=tex2html5404 HREF="node261.html"> Programmer Interface Concepts</A>
|
|
<B> Previous:</B> <A NAME=tex2html5398 HREF="node299.html"> Definitions of Make-Instance </A>
|
|
<HR> <P>
|
|
<H2><A NAME=SECTION0032110000000000000000>28.1.10. Redefining Classes</A></H2>
|
|
<P>
|
|
<img align=bottom alt="change_begin" src="gif/change_begin.gif"><br>
|
|
<A NAME=RedefiningClassesSECTION>A</A>
|
|
class that is an instance of <tt>standard-class</tt> can be redefined
|
|
if the new class will also be an instance of <tt>standard-class</tt>.
|
|
Redefining a class modifies the existing class object to reflect the
|
|
new class definition; it does not create a new class object for the
|
|
class. Any method object created by a <tt>:reader</tt>, <tt>:writer</tt>, or
|
|
<tt>:accessor</tt> option specified by the old <tt>defclass</tt> form is
|
|
removed from the corresponding generic function.
|
|
Methods specified by the new <tt>defclass</tt> form are added.
|
|
<P>
|
|
|
|
<P>
|
|
When the class <i>C</i> is redefined, changes are propagated to its instances
|
|
and to instances of any of its subclasses. Updating such an
|
|
instance occurs at an implementation-dependent time, but no later than
|
|
the next time a slot of that instance is read or written. Updating an
|
|
instance does not change its identity as defined by the <tt>eq</tt>
|
|
function. The updating process may change the slots of that
|
|
particular instance, but it does not create a new instance. Whether
|
|
updating an instance consumes storage is implementation-dependent.
|
|
<P>
|
|
Note that redefining a class may cause slots to be added or deleted.
|
|
If a class is redefined in a way that changes the set of local slots
|
|
accessible in instances, the instances will be updated. It is
|
|
implementation-dependent whether instances are updated if a class is
|
|
redefined in a way that does not change the set of local slots
|
|
accessible in instances.
|
|
<P>
|
|
The value of a slot that is specified as shared both in the old class
|
|
and in the new class is retained. If such a shared slot was unbound
|
|
in the old class, it will be unbound in the new class. Slots that
|
|
were local in the old class and that are shared in the new class are
|
|
initialized. Newly added shared slots are initialized.
|
|
<P>
|
|
Each newly added shared slot is set to the result of evaluating the
|
|
captured <tt>:initform</tt> form for the slot that was specified in the
|
|
<tt>defclass</tt> form for the new class. If there is no <tt>:initform</tt>
|
|
form, the slot is unbound.
|
|
<P>
|
|
If a class is redefined in such a way that the set of local slots
|
|
accessible in an instance of the class is changed, a two-step process
|
|
of updating the instances of the class takes place. The process may
|
|
be explicitly started by invoking the generic function
|
|
<tt>make-instances-obsolete</tt>. This two-step process can happen in other
|
|
circumstances in some implementations. For example, in some
|
|
implementations this two-step process will be triggered if the order
|
|
of slots in storage is changed.
|
|
<P>
|
|
The first step modifies the structure of the instance by adding new
|
|
local slots and discarding local slots that are not defined in the new
|
|
version of the class.
|
|
The second step initializes the newly added local slots and performs
|
|
any other user-defined actions. These steps are further specified
|
|
in the next two sections.
|
|
<br><img align=bottom alt="change_end" src="gif/change_end.gif">
|
|
<P>
|
|
<HR>
|
|
<UL>
|
|
<LI> <A NAME=tex2html5409 HREF="node301.html#SECTION0032110100000000000000"> Modifying the Structure of Instances</A>
|
|
<LI> <A NAME=tex2html5410 HREF="node302.html#SECTION0032110200000000000000"> Initializing Newly Added Local Slots</A>
|
|
<LI> <A NAME=tex2html5411 HREF="node303.html#SECTION0032110300000000000000"> Customizing Class Redefinition</A>
|
|
<LI> <A NAME=tex2html5412 HREF="node304.html#SECTION0032110400000000000000"> Extensions</A>
|
|
</UL>
|
|
<BR> <HR><A NAME=tex2html5405 HREF="node301.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html5403 HREF="node261.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html5397 HREF="node299.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html5407 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html5408 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
|
|
<B> Next:</B> <A NAME=tex2html5406 HREF="node301.html"> Modifying the Structure </A>
|
|
<B>Up:</B> <A NAME=tex2html5404 HREF="node261.html"> Programmer Interface Concepts</A>
|
|
<B> Previous:</B> <A NAME=tex2html5398 HREF="node299.html"> Definitions of Make-Instance </A>
|
|
<HR> <P>
|
|
<HR>
|
|
<P><ADDRESS>
|
|
AI.Repository@cs.cmu.edu
|
|
</ADDRESS>
|
|
</BODY>
|