forked from robert-strandh/CLOS-MOP-HTML
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathallocate-instance.html
99 lines (82 loc) · 2.93 KB
/
allocate-instance.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
<HTML>
<HEAD>
<TITLE>allocate-instance</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="all-no-methods.html" title="Up">
<li class=navigation><img src="up.png" alt="Up">
</li>
</a>
</ul>
<A NAME="allocate-instance"><I>Generic Function</I> <B>ALLOCATE-INSTANCE</B>
<P><B>Syntax:</B></P>
<P><B>allocate-instance</B> <I>class</I> <I><TT>&rest</TT></I> <I>initargs</I> =>
<I>instance</I>
<P><B>Arguments and values:</B></P>
<P><I>class</I> -- A class metaobject.</P>
<P><I>initargs</I> -- A list of alternating initialization argument
names and values.
</P>
<P><I>instance</I> -- A newly allocated instance of <I>class</I>.</P>
<P><B>Description:</B></P>
<p>
This generic function is called to create a new, uninitialized
instance of a class. The interpretation of the concept of an
``uninitialized'' instance depends on the class metaobject class.
</p>
<p>
Before allocating the new instance,
<a href="class-finalized-p.html">class-finalized-p</a> is called to
see if <I>class</I> has been finalized. If it has not been finalized,
<a href="finalize-inheritance.html">finalize-inheritance</a> is called
before the new instance is allocated.
</p>
<P><B>Methods:</B></P>
<table>
<tr>
<td><a href="allocate-instance-standard-class.html">
<B>allocate-instance</B> (<I>class</I> standard-class)
<I><TT>&rest</TT></I> <I>initargs</I></a>
</td>
</tr>
<tr>
<td><a href="allocate-instance-funcallable-standard-class.html">
<B>allocate-instance</B> (<I>class</I> funcallable-standard-class)
<I><TT>&rest</TT></I> <I>initargs</I></a>
</td>
</tr>
<tr>
<td><a href="allocate-instance-built-in-class.html">
<B>allocate-instance</B> (<I>class</I> built-in-class)
<I><TT>&rest</TT></I> <I>initargs</I></a>
</td>
</tr>
</table>
<P><B>Comments and remarks:</B></P>
<P>
See also the
<a href="http://www.lispworks.com/documentation/HyperSpec/Body/f_alloca.htm#allocate-instance">
description of this function in the Common Lisp HyperSpec</a>.
</P>
<P>
The description above suggests that <TT>allocate-instance</TT>
checks to see whether the class is finalized and if not, calls
<a href="finalize-inheritance.html">finalize-inheritance</a>.
However, the <I>initargs</I> passed to <TT>allocate-instance</TT>
should be the defaulted initargs, and computing those initargs
requires the class to be finalized. Therefore,
<a href="finalize-inheritance.html">finalize-inheritance</a> must be
called <I>before</I> <TT>allocate-instance</TT> is called. Peeking
at PCL source confirms that
<a href="finalize-inheritance.html">finalize-inheritance</a> is
called from <a href="make-instance.html">make-instance</a>
before <TT>allocate-instance</TT> is called.
</P>
</BODY>
</HTML>