forked from robert-strandh/CLOS-MOP-HTML
-
Notifications
You must be signed in to change notification settings - Fork 0
/
class-finalization-protocol.html
113 lines (101 loc) · 4.43 KB
/
class-finalization-protocol.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<HTML>
<HEAD>
<TITLE>Class finalization protocol</TITLE>
<LINK rel="stylesheet" type="text/css" href="clos-mop.css">
</HEAD>
<BODY>
<ul class=navigation>
<a href="table-of-contents.html" title="Table of contents">
<li class=navigation><img src="toc.png" alt="TOC">
</li>
</a>
<a href="initialization-of-generic-function-and-method-metaobjects.html" title="Prev">
<li class=navigation><img src="prev.png" alt="Prev">
</li>
</a>
<a href="subprotocols.html" title="Up">
<li class=navigation><img src="up.png" alt="Up">
</li>
</a>
<a href="instance-structure-protocol.html" title="Next">
<li class=navigation><img src="next.png" alt="Next">
</li>
</a>
</ul>
<H3>Class finalization protocol</H3>
<P>
Class <I>finalization</I> is the process of computing the information
a class inherits from its superclasses and preparing to actually
allocate instances of the class. The class finalization process
includes computing the class precedence list of the class, the full set of
slots accessible in instances of the class and the full set of default
initialization arguments for the class. These values are associated
with the class metaobject and can be accessed by calling the
appropriate reader. In addition, the class finalization process makes
decisions about how instances of the class will be implemented.
</P>
<P>
To support forward-referenced superclasses, and to account for the fact that
not all classes are actually instantiated, class finalization is not done as
part of the initialization of the class metaobject. Instead, finalization is
done as a separate protocol, invoked by calling the generic function
<a href="finalize-inheritance.html">finalize-inheritance</a>. The
exact point at
which <a href="finalize-inheritance.html">finalize-inheritance</a> is
called depends on the class of the class metaobject; for
<a href="class-standard-class.html">
standard-class</a> it is called sometime after all the superclasses
of the class are defined, but no later than when the first instance of
the class is allocated
(by <a href="allocate-instance.html">allocate-instance</a>).
</P>
<P>
The first step of class finalization is computing the class precedence list.
Doing this first allows subsequent steps to access the class precedence list.
This step is performed by calling the generic function
<a href="compute-class-precedence-list.html">compute-class-precedence-list</a>.
The value returned from this call is associated with the class
metaobject and can be accessed by calling the
<a href="class-precedence-list.html">class-precedence-list</a> generic function.
</P>
<P>
The second step is computing the full set of slots that will be
accessible in instances of the class. This step is performed by
calling the generic
function <a href="compute-slots.html">compute-slots</a>. The result
of this call is a list of effective slot definition metaobjects. This
value is associated with the class metaobject and can be accessed by
calling the <a href="class-slots.html">class-slots</a> generic
function.
</P>
<P>
The behavior of <a href="compute-slots.html">compute-slots</a> is
itself layered, consisting of calls
to <a href="effective-slot-definition-class.html">effective-slot-definition-class</a>
and <a href="compute-effective-slot-definition.html">compute-effective-slot-definition</a>.
</P>
<P>
The final step of class finalization is computing the full set of
initialization arguments for the class. This is done by calling the
generic
function <a href="compute-default-initargs.html">compute-default-initargs</a>.
The value returned by this generic function is associated with the
class metaobject and can be accessed by
calling <a href="class-default-initargs.html">class-default-initargs</a>.
</P>
<P>
If the class was previously finalized, <a href="finalize-inheritance.html">finalize-inheritance</a> may call
<a href="make-instances-obsolete.html">make-instances-obsolete</a>.
The circumstances under which this happens are describe in
<a href="http://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node300.html#SECTION0032110000000000000000">
the section of the CLOS specification called ``Redefining Classes.''</a>
</P>
<P>
Forward-referenced classes, which provide a temporary definition for a
class which has been referenced but not yet defined, can never be
finalized. An error is signalled
if <a href="finalize-inheritance.html">finalize-inheritance</a> is
called on a forward-referenced class.
</P>
</BODY>
</HTML>