| 1 |
<?xml version="1.0" encoding="utf-8"?> |
| 2 |
<!DOCTYPE book [ |
| 3 |
<!ENTITY % eclent SYSTEM "ecl.ent"> |
| 4 |
%eclent; |
| 5 |
]> |
| 6 |
<book xmlns="http://docbook.org/ns/docbook" version="5.0" xml:lang="en"> |
| 7 |
<chapter label="11" xml:id="CLOS"> |
| 8 |
<title>CLOS</title> |
| 9 |
<blockquote> |
| 10 |
<screen><indexterm role="fn"><primary>add-method</primary></indexterm>— Generic: <function>add-method</function> <varname>generic-function</varname> <varname>method</varname></screen> |
| 11 |
<screen><indexterm role="fn"><primary>add-method</primary></indexterm>— Method: <function>add-method</function> (</screen> |
| 12 |
</blockquote> |
| 13 |
<blockquote> |
| 14 |
<screen><indexterm role="fn"><primary>call-method</primary></indexterm>— Macro: <function>call-method</function> <varname>method next-method-list</varname></screen> |
| 15 |
</blockquote> |
| 16 |
<blockquote> |
| 17 |
<screen><indexterm role="fn"><primary>call-next-method</primary></indexterm>— Macro: <function>call-next-method</function> <varname>&rest args</varname></screen> |
| 18 |
</blockquote> |
| 19 |
<blockquote> |
| 20 |
<screen><indexterm role="fn"><primary>change-class</primary></indexterm>— Generic: <function>change-class</function> <varname>instance</varname> <varname>new-class</varname></screen> |
| 21 |
<screen><indexterm role="fn"><primary>change-class</primary></indexterm>— Method: <function>change-class</function> (</screen> |
| 22 |
<screen><indexterm role="fn"><primary>change-class</primary></indexterm>— Method: <function>change-class</function> (</screen> |
| 23 |
</blockquote> |
| 24 |
<blockquote> |
| 25 |
<screen><indexterm role="fn"><primary>class-name</primary></indexterm>— Generic: <function>class-name</function> <varname>class</varname></screen> |
| 26 |
<screen><indexterm role="fn"><primary>class-name</primary></indexterm>— Method: <function>class-name</function> (</screen> |
| 27 |
</blockquote> |
| 28 |
<blockquote> |
| 29 |
<screen><indexterm role="fn"><primary>(setf class-name)</primary></indexterm>— Generic: <function>(setf class-name)</function> <varname>new-value</varname> <varname>class</varname></screen> |
| 30 |
<screen><indexterm role="fn"><primary>(setf class-name)</primary></indexterm>— Method: <function>(setf class-name)</function> <varname>new-value (class class)</varname></screen> |
| 31 |
</blockquote> |
| 32 |
<blockquote> |
| 33 |
<screen><indexterm role="fn"><primary>class-of</primary></indexterm>— Function: <function>class-of</function> <varname>object</varname></screen> |
| 34 |
<para>The function <literal>class-of</literal> returns the class of which the given object is an |
| 35 |
instance. The argument to class-of may be any Common-Lisp object.</para> |
| 36 |
</blockquote> |
| 37 |
<blockquote> |
| 38 |
<screen><indexterm role="fn"><primary>compute-applicable-methods</primary></indexterm>— Function: <function>compute-applicable-methods</function> <varname>generic-function function-arguments</varname></screen> |
| 39 |
</blockquote> |
| 40 |
<blockquote> |
| 41 |
<screen><indexterm role="fn"><primary>defclass</primary></indexterm>— Macro: <function>defclass</function> <varname>class-name (@{superclass-name@}*)</varname> (<varname>{</varname><varname>slot-specifier</varname><varname>}</varname><varname>*</varname>) [<varname>class-option</varname>]</screen> |
| 42 |
<screen> |
| 43 |
<replaceable>class-name</replaceable> ::= <replaceable>symbol</replaceable> |
| 44 |
<replaceable>superclass-name</replaceable> ::= <replaceable>symbol</replaceable> |
| 45 |
<replaceable>slot-specifier</replaceable> ::= <replaceable>slot-name</replaceable> | (<replaceable>slot-name</replaceable> [<replaceable>slot-option</replaceable>]) |
| 46 |
<replaceable>slot-name</replaceable> ::= <replaceable>symbol</replaceable> |
| 47 |
<replaceable>slot-option</replaceable> ::= {:reader <replaceable>reader-function-name</replaceable>}* |
| 48 |
| {:writer <replaceable>writer-function-name</replaceable>}* |
| 49 |
| {:accessor <replaceable>reader-function-name</replaceable>}* |
| 50 |
| {:allocation <replaceable>allocation-type</replaceable>} |
| 51 |
| {:initarg <replaceable>initarg-name</replaceable>}* |
| 52 |
| {:initform <replaceable>form</replaceable>} |
| 53 |
| {:type <replaceable>type-specifier</replaceable>} |
| 54 |
| {:documentation <replaceable>string</replaceable>} |
| 55 |
<replaceable>reader-function-name</replaceable> ::= <replaceable>symbol</replaceable> |
| 56 |
<replaceable>writer-function-name</replaceable> ::= <replaceable>function-name</replaceable> |
| 57 |
<replaceable>function-name</replaceable> ::= <replaceable>symbol</replaceable> |(setf <replaceable>symbol</replaceable>) |
| 58 |
<replaceable>initarg-name</replaceable> ::= <replaceable>symbol</replaceable> |
| 59 |
<replaceable>allocation-type</replaceable> ::= :instance | :class |
| 60 |
<replaceable>class-option</replaceable> ::= (:default-initargs <replaceable>initarg-list</replaceable>) |
| 61 |
| (:documentation <replaceable>string</replaceable>) |
| 62 |
| (:metaclass <replaceable>class-name</replaceable>) |
| 63 |
<replaceable>initarg-list</replaceable> ::= {<replaceable>initarg-name</replaceable> <replaceable>default-initial-value-form</replaceable>}* |
| 64 |
</screen> |
| 65 |
</blockquote> |
| 66 |
<blockquote> |
| 67 |
<screen><indexterm role="fn"><primary>defgeneric</primary></indexterm>— Macro: <function>defgeneric</function> <varname>function-name lambda-list [option | @{method-description@}*]</varname></screen> |
| 68 |
<screen> |
| 69 |
<replaceable>function-name</replaceable> ::= <replaceable>symbol</replaceable> | (setf <replaceable>symbol</replaceable>) |
| 70 |
<replaceable>lambda-list</replaceable> ::= ({<replaceable>var</replaceable>}* |
| 71 |
[&optional {<replaceable>var</replaceable> | (<replaceable>var</replaceable>)}*] |
| 72 |
[&rest <replaceable>var</replaceable>] |
| 73 |
[&key {<replaceable>keyword-parameter</replaceable>}* [&allow-other-keys]]) |
| 74 |
<replaceable>keyword-parameter</replaceable> ::= <replaceable>var</replaceable> | ( {<replaceable>var</replaceable> | (<replaceable>keywordvar</replaceable> )}) |
| 75 |
<replaceable>option</replaceable> ::= (:argument-precedence-order {<replaceable>parameter-name</replaceable>}+) |
| 76 |
| (declare {<replaceable>declaration</replaceable>}+) |
| 77 |
| (:documentation <replaceable>string</replaceable>) |
| 78 |
| (:method-combination symbol {<replaceable>arg</replaceable>}*) |
| 79 |
| (:generic-function-class <replaceable>class-name</replaceable>) |
| 80 |
| (:method-class <replaceable>class-name</replaceable>) |
| 81 |
<replaceable>method-description</replaceable> ::= |
| 82 |
(:method {<replaceable>method-qualifier</replaceable>}* <replaceable>specialized-lambda-list</replaceable> |
| 83 |
[{<replaceable>declaration</replaceable>}* | <replaceable>documentation</replaceable>] |
| 84 |
{<replaceable>form</replaceable>}*) |
| 85 |
<replaceable>method-qualifier</replaceable> ::= <replaceable>non-nil-atom</replaceable> |
| 86 |
<replaceable>specialized-lambda-list</replaceable> ::= ({<replaceable>var</replaceable> | (<replaceable>var</replaceable> <replaceable>parameter-specializer-name</replaceable>)}* |
| 87 |
[&optional {<replaceable>var</replaceable> | (<replaceable>var</replaceable> [<replaceable>initform</replaceable> [<replaceable>supplied-p-parameter</replaceable>]])}*] |
| 88 |
[&rest <replaceable>var</replaceable>] |
| 89 |
[&key {<replaceable>specialized-keyword-parameter</replaceable>}* [&allow-other-keys]]) |
| 90 |
[&aux {<replaceable>var</replaceable> | (<replaceable>var</replaceable> [<replaceable>initform</replaceable>])}*] ) |
| 91 |
<replaceable>specialized-keyword-parameter</replaceable> ::= <replaceable>var</replaceable> |
| 92 |
| {({<replaceable>var</replaceable> | (<replaceable>keywordvar</replaceable>)} [<replaceable>initform</replaceable> [<replaceable>supplied-p-parameter</replaceable>]])}* |
| 93 |
<replaceable>parameter-specializer-name</replaceable> ::= <replaceable>symbol</replaceable> | (eql <replaceable>eql-specializer-form</replaceable>) |
| 94 |
</screen> |
| 95 |
</blockquote> |
| 96 |
<blockquote> |
| 97 |
<screen><indexterm role="fn"><primary>define-method-combination</primary></indexterm>— Macro: <function>define-method-combination</function> <varname>name [short-form-option]</varname></screen> |
| 98 |
<screen><indexterm role="fn"><primary>define-method-combination</primary></indexterm>— Macro: <function>define-method-combination</function> <varname>name lambda-list (@{method-group-specifier@}*) [(:arguments . lambda-list)] [(:generic-function generic-fn-symbol)] [@{declaration@}* | doc-string] @{form@}*</varname></screen> |
| 99 |
<screen> |
| 100 |
<replaceable>short-form-option</replaceable> ::= :documentation <replaceable>string</replaceable> |
| 101 |
| :identity-with-one-argument <replaceable>boolean</replaceable> |
| 102 |
| :operator <replaceable>operator</replaceable> |
| 103 |
<replaceable>method-group-specifier</replaceable> ::= (<replaceable>variable</replaceable> {<replaceable>qualifier-pattern</replaceable>}+ | <replaceable>predicate</replaceable> |
| 104 |
[<replaceable>long-form-option</replaceable>]) |
| 105 |
<replaceable>long-form-option</replaceable> ::= :description <replaceable>format-string</replaceable> |
| 106 |
| :order <replaceable>order</replaceable> |
| 107 |
| :required <replaceable>boolean</replaceable> |
| 108 |
</screen> |
| 109 |
</blockquote> |
| 110 |
<blockquote> |
| 111 |
<screen><indexterm role="fn"><primary>defmethod</primary></indexterm>— Macro: <function>defmethod</function> <varname>function-name @{method-qualifier@}+ specialized-lambda-list [@{declaration@}* | doc-string] @{form@}*</varname></screen> |
| 112 |
<screen> |
| 113 |
<replaceable>function-name</replaceable> ::= <replaceable>symbol</replaceable> | (setf <replaceable>symbol</replaceable>) |
| 114 |
<replaceable>method-qualifier</replaceable> ::= <replaceable>non-nil-atom</replaceable> |
| 115 |
<replaceable>parameter-specializer-name</replaceable> ::= <replaceable>symbol</replaceable> | (eql <replaceable>eql-specializer-form</replaceable> ) |
| 116 |
</screen> |
| 117 |
</blockquote> |
| 118 |
<blockquote> |
| 119 |
<screen><indexterm role="fn"><primary>documentation</primary></indexterm>— Generic: <function>documentation</function> <varname>x</varname> <varname>&optional</varname> <varname>doc-type</varname></screen> |
| 120 |
<screen><indexterm role="fn"><primary>documentation</primary></indexterm>— Method: <function>documentation</function> (</screen> |
| 121 |
<screen><indexterm role="fn"><primary>documentation</primary></indexterm>— Method: <function>documentation</function> (</screen> |
| 122 |
<screen><indexterm role="fn"><primary>documentation</primary></indexterm>— Method: <function>documentation</function> (</screen> |
| 123 |
<screen><indexterm role="fn"><primary>doumentation</primary></indexterm>— Method: <function>doumentation</function> (</screen> |
| 124 |
<screen><indexterm role="fn"><primary>documentation</primary></indexterm>— Method: <function>documentation</function> (</screen> |
| 125 |
<screen><indexterm role="fn"><primary>documentation</primary></indexterm>— Method: <function>documentation</function> (</screen> |
| 126 |
<screen><indexterm role="fn"><primary>documentation</primary></indexterm>— Method: <function>documentation</function> (</screen> |
| 127 |
</blockquote> |
| 128 |
<blockquote> |
| 129 |
<screen><indexterm role="fn"><primary>(setf documentation)</primary></indexterm>— Generic: <function>(setf documentation)</function> <varname>new-value</varname> <varname>x</varname> <varname>&optional</varname> <varname>doc-type</varname></screen> |
| 130 |
<screen><indexterm role="fn"><primary>(setf documentation)</primary></indexterm>— Method: <function>(setf documentation)</function> <varname>new-value (method standard-method) @optional{} doc-type</varname></screen> |
| 131 |
<screen><indexterm role="fn"><primary>(setf documentation)</primary></indexterm>— Method: <function>(setf documentation)</function> <varname>new-value (class standard-class) @optional{} doc-type</varname></screen> |
| 132 |
<screen><indexterm role="fn"><primary>(setf documentation)</primary></indexterm>— Method: <function>(setf documentation)</function> <varname>new-value (method-combination method-combination)</varname></screen> |
| 133 |
<screen><indexterm role="fn"><primary>(setf documentation)</primary></indexterm>— Method: <function>(setf documentation)</function> <varname>new-value (slot-description standard-slot-description) @optional{} doc-type</varname></screen> |
| 134 |
<screen><indexterm role="fn"><primary>(setf documentation)</primary></indexterm>— Method: <function>(setf documentation)</function> <varname>new-value (symbol symbol) @optional{} doc-type</varname></screen> |
| 135 |
<screen><indexterm role="fn"><primary>(setf documentation)</primary></indexterm>— Method: <function>(setf documentation)</function> <varname>new-value (list list) @optional{} doc-type</varname></screen> |
| 136 |
</blockquote> |
| 137 |
<blockquote> |
| 138 |
<screen><indexterm role="fn"><primary>ensure-generic-function</primary></indexterm>— Function: <function>ensure-generic-function</function> <varname>{</varname><varname>function-name</varname> <varname>&key</varname> <varname>lambda-list</varname> <varname>&key</varname> <varname>:argument-precedence-order</varname> <varname>:declare</varname> <varname>:documentation</varname> <varname>:generic-function-class|ekeys</varname><varname>:method-combination :method-class :environment</varname><varname>}</varname></screen> |
| 139 |
<screen> |
| 140 |
function-name ::= symbol | (setf symbol) |
| 141 |
</screen> |
| 142 |
</blockquote> |
| 143 |
<blockquote> |
| 144 |
<screen><indexterm role="fn"><primary>find-class</primary></indexterm>— Function: <function>find-class</function> <varname>symbol @optional{} errorp environment</varname></screen> |
| 145 |
<para>The function find-class returns the class object named by the given symbol in the given environment. |
| 146 |
The first argument to find-class is a symbol.</para> |
| 147 |
</blockquote> |
| 148 |
<blockquote> |
| 149 |
<screen><indexterm role="fn"><primary>find-method</primary></indexterm>— Generic: <function>find-method</function> <varname>generic-function</varname> <varname>method-qualifiers</varname> <varname>specializers</varname> <varname>&optional</varname> <varname>errorp</varname></screen> |
| 150 |
<screen><indexterm role="fn"><primary>find-method</primary></indexterm>— Method: <function>find-method</function> (</screen> |
| 151 |
<para>method-qualifiers specializers &optional errorp</para> |
| 152 |
</blockquote> |
| 153 |
<blockquote> |
| 154 |
<screen><indexterm role="fn"><primary>function-keywords</primary></indexterm>— Generic: <function>function-keywords</function> <varname>method</varname></screen> |
| 155 |
<screen><indexterm role="fn"><primary>function-keywords</primary></indexterm>— Method: <function>function-keywords</function> (</screen> |
| 156 |
</blockquote> |
| 157 |
<para>The generic function function-keywords is used to return the keyword parameter specifiers for a given method.</para> |
| 158 |
<blockquote> |
| 159 |
<screen><indexterm role="fn"><primary>generic-function</primary></indexterm>— Macro: <function>generic-function</function> <varname>{</varname><varname>lambda-list</varname> <varname>\mchoice</varname><varname>option | @{method-description@}*</varname><varname>}</varname></screen> |
| 160 |
<screen> |
| 161 |
option ::= (:argument-precedence-order {parameter-name}+) |
| 162 |
| (declare {declaration}+) |
| 163 |
| (:documentation string) |
| 164 |
| (:method-combination symbol {arg}*) |
| 165 |
| (:generic-function-class class-name) |
| 166 |
| (:method-class class-name) |
| 167 |
method-description ::= (:method {method-qualifier}* |
| 168 |
specialized-lambda-list |
| 169 |
{declaration | <replaceable>documentation</replaceable>}* |
| 170 |
{form}*) |
| 171 |
</screen> |
| 172 |
<para>The <literal>generic-function</literal> macro creates an anonymous generic function. The |
| 173 |
generic function is created with the set of methods specified by its method |
| 174 |
descriptions. The <replaceable>option</replaceable>, <replaceable>method-qualifier</replaceable>, and |
| 175 |
<replaceable>specialized-lambda-list</replaceable> arguments are the same as for <literal>defgeneric</literal>. |
| 176 |
The generic function object is returned as the result. If no method |
| 177 |
descriptions are specified, an anonymous generic function with no methods is |
| 178 |
created. See defgeneric, generic-flet, |
| 179 |
generic-labels, defmethod.</para> |
| 180 |
</blockquote> |
| 181 |
<blockquote> |
| 182 |
<screen><indexterm role="fn"><primary>initialize-instance</primary></indexterm>— Generic: <function>initialize-instance</function> <varname>instance</varname> <varname>&rest</varname> <varname>initargs</varname></screen> |
| 183 |
<screen><indexterm role="fn"><primary>initialize-instance</primary></indexterm>— Method: <function>initialize-instance</function> (</screen> |
| 184 |
<para>The generic function <literal>initialize-instance</literal> is called by |
| 185 |
<literal>make-instance</literal> to initialize a newly created instance. The generic |
| 186 |
function <literal>initialize-instance</literal> is called with the new instance and the |
| 187 |
defaulted initialization arguments.</para> |
| 188 |
</blockquote> |
| 189 |
<blockquote> |
| 190 |
<screen><indexterm role="fn"><primary>invalid-method-error</primary></indexterm>— Function: <function>invalid-method-error</function> <varname>method format-string @rest{} args</varname></screen> |
| 191 |
<para>The function <literal>invalid-method-error</literal> is used to signal an error when there |
| 192 |
is an applicable method whose qualifiers are not valid for the method |
| 193 |
combination type. The error message is constructed by using a format string |
| 194 |
and any arguments to it. Because an implementation may need to add additional |
| 195 |
contextual information to the error message, invalid-method-error should be |
| 196 |
called only within the dynamic extent of a method combination function. The |
| 197 |
function invalid-method-error is called automatically when a method fails to |
| 198 |
satisfy every qualifier pattern and predicate in a define-method-combination |
| 199 |
form. A method combination function that imposes additional restrictions |
| 200 |
should call invalid-method-error explicitly if it encounters a method it cannot |
| 201 |
accept.</para> |
| 202 |
</blockquote> |
| 203 |
<blockquote> |
| 204 |
<screen><indexterm role="fn"><primary>make-instance</primary></indexterm>— Generic: <function>make-instance</function> <varname>class</varname> <varname>&rest</varname><varname> initargs</varname></screen> |
| 205 |
<screen><indexterm role="fn"><primary>make-instance</primary></indexterm>— Method: <function>make-instance</function> (</screen> |
| 206 |
<screen><indexterm role="fn"><primary>make-instance</primary></indexterm>— Method: <function>make-instance</function> (</screen> |
| 207 |
<para>The generic function make-instance creates and returns a new instance of the |
| 208 |
given class. The generic function make-instance may be used as described in |
| 209 |
section 1.9. The class argument is a class object or a symbol that names a |
| 210 |
class. The remaining arguments form a list of alternating initialization |
| 211 |
argument names and values. If the second of the above methods is selected, |
| 212 |
that method invokes make-instance on the arguments (find-class class) and |
| 213 |
initargs. The initialization arguments are checked within make-instance (see |
| 214 |
section 1.9). The new instance is returned.</para> |
| 215 |
</blockquote> |
| 216 |
<blockquote> |
| 217 |
<screen><indexterm role="fn"><primary>make-instances-obsolete</primary></indexterm>— Generic: <function>make-instances-obsolete</function> <varname>class</varname></screen> |
| 218 |
<screen><indexterm role="fn"><primary>make-instances-obsolete</primary></indexterm>— Method: <function>make-instances-obsolete</function> (</screen> |
| 219 |
<screen><indexterm role="fn"><primary>make-instances-obsolete</primary></indexterm>— Method: <function>make-instances-obsolete</function> (</screen> |
| 220 |
</blockquote> |
| 221 |
<blockquote> |
| 222 |
<screen><indexterm role="fn"><primary>method-combination-error</primary></indexterm>— Function: <function>method-combination-error</function> <varname>format-string @rest{} args</varname></screen> |
| 223 |
<para>The function method-combination-error is used to signal an error in method |
| 224 |
combination. The error message is constructed by using a format string and any |
| 225 |
arguments to it. Because an implementation may need to add additional |
| 226 |
contextual information to the error message, method-combination-error should be |
| 227 |
called only within the dynamic extent of a method combination function. The |
| 228 |
format-string argument is a control string that can be given to format, and |
| 229 |
args are any arguments required by that string.</para> |
| 230 |
</blockquote> |
| 231 |
<blockquote> |
| 232 |
<screen><indexterm role="fn"><primary>method-qualifiers</primary></indexterm>— Generic: <function>method-qualifiers</function> <varname>method</varname></screen> |
| 233 |
<screen><indexterm role="fn"><primary>method-qualifiers</primary></indexterm>— Method: <function>method-qualifiers</function> (</screen> |
| 234 |
<para>The generic function method-qualifiers returns a list of the qualifiers |
| 235 |
of the given method.</para> |
| 236 |
</blockquote> |
| 237 |
<blockquote> |
| 238 |
<screen><indexterm role="fn"><primary>next-method-p</primary></indexterm>— Function: <function>next-method-p</function> <varname></varname></screen> |
| 239 |
<para>The locally defined function next-method-p can be used within the body of a |
| 240 |
method defined by a method-defining form to determine whether a next method |
| 241 |
exists.</para> |
| 242 |
</blockquote> |
| 243 |
<blockquote> |
| 244 |
<screen><indexterm role="fn"><primary>no-applicable-method</primary></indexterm>— Generic: <function>no-applicable-method</function> <varname>generic-function</varname> <varname>&rest</varname> <varname>function-arguments</varname></screen> |
| 245 |
<screen><indexterm role="fn"><primary>no-applicable-method</primary></indexterm>— Method: <function>no-applicable-method</function> (</screen> |
| 246 |
<para>The generic function no-applicable-method is called when a generic function of |
| 247 |
the class standard-generic-function is invoked and no method on that generic |
| 248 |
function is applicable. The default method signals an error.</para> |
| 249 |
</blockquote> |
| 250 |
<blockquote> |
| 251 |
<screen><indexterm role="fn"><primary>no-next-method</primary></indexterm>— Generic: <function>no-next-method</function> <varname>generic-function</varname> <varname>method</varname> <varname>&rest</varname> <varname>args</varname></screen> |
| 252 |
<screen><indexterm role="fn"><primary>no-next-method</primary></indexterm>— Method: <function>no-next-method</function> (</screen> |
| 253 |
</blockquote> |
| 254 |
<blockquote> |
| 255 |
<screen><indexterm role="fn"><primary>print-object</primary></indexterm>— Generic: <function>print-object</function> <varname>object</varname> <varname>stream</varname></screen> |
| 256 |
<screen><indexterm role="fn"><primary>print-object</primary></indexterm>— Method: <function>print-object</function> (</screen> |
| 257 |
<para>The generic function print-object writes the printed representation of an |
| 258 |
object to a stream. The function print-object is called by the print system; |
| 259 |
it should not be called by the user.</para> |
| 260 |
</blockquote> |
| 261 |
<blockquote> |
| 262 |
<screen><indexterm role="fn"><primary>reinitialize-instance</primary></indexterm>— Generic: <function>reinitialize-instance</function> <varname>instance</varname> <varname>&rest</varname> <varname>initargs</varname></screen> |
| 263 |
<screen><indexterm role="fn"><primary>reinitialize-instance</primary></indexterm>— Method: <function>reinitialize-instance</function> (</screen> |
| 264 |
<para>The generic function reinitialize-instance can be used to change the |
| 265 |
values of local slots according to initialization arguments. This |
| 266 |
generic function is called by the Meta-Object Protocol. It can also be |
| 267 |
called by users.</para> |
| 268 |
</blockquote> |
| 269 |
<blockquote> |
| 270 |
<screen><indexterm role="fn"><primary>remove-method</primary></indexterm>— Generic: <function>remove-method</function> <varname>generic-function</varname> <varname>method</varname></screen> |
| 271 |
<screen><indexterm role="fn"><primary>remove-method</primary></indexterm>— Method: <function>remove-method</function> (</screen> |
| 272 |
<para>The generic function remove-method removes a method from a generic function. |
| 273 |
It destructively modifies the specified generic function and returns the |
| 274 |
modified generic function as its result.</para> |
| 275 |
</blockquote> |
| 276 |
<blockquote> |
| 277 |
<screen><indexterm role="fn"><primary>shared-initialize</primary></indexterm>— Generic: <function>shared-initialize</function> <varname>instance slot-names &rest initargs</varname></screen> |
| 278 |
<screen><indexterm role="fn"><primary>shared-initialize</primary></indexterm>— Method: <function>shared-initialize</function> (</screen> |
| 279 |
<para>The generic function shared-initialize is used to fill the slots of an instance |
| 280 |
using initialization arguments and :initform forms. It is called when an |
| 281 |
instance is created, when an instance is re-initialized, when an instance is |
| 282 |
updated to conform to a redefined class, and when an instance is updated to |
| 283 |
conform to a different class. The generic function <literal>shared-initialize</literal> is |
| 284 |
called by the system-supplied primary method for <literal>initialize-instance</literal>, |
| 285 |
<literal>reinitialize-instance</literal>, <literal>update-instance-for-redefined-class</literal>, and |
| 286 |
<literal>update-instance-for-different-class</literal>.</para> |
| 287 |
</blockquote> |
| 288 |
<blockquote> |
| 289 |
<screen><indexterm role="fn"><primary>slot-boundp</primary></indexterm>— Function: <function>slot-boundp</function> <varname>instance slot-name</varname></screen> |
| 290 |
<para>The function slot-boundp tests whether a specific slot in an instance is bound. |
| 291 |
The arguments are the instance and the name of the slot.</para> |
| 292 |
</blockquote> |
| 293 |
<blockquote> |
| 294 |
<screen><indexterm role="fn"><primary>slot-exists-p</primary></indexterm>— Function: <function>slot-exists-p</function> <varname>object slot-name</varname></screen> |
| 295 |
<para>The function slot-exists-p tests whether the specified object has a slot of the |
| 296 |
given name. The object argument is any object. The slot-name argument is a |
| 297 |
symbol.</para> |
| 298 |
</blockquote> |
| 299 |
<blockquote> |
| 300 |
<screen><indexterm role="fn"><primary>slot-makunbound</primary></indexterm>— Function: <function>slot-makunbound</function> <varname>instance slot-name</varname></screen> |
| 301 |
<para>The function slot-makunbound restores a slot in an instance to the unbound |
| 302 |
state. The arguments to slot-makunbound are the instance and the name of the |
| 303 |
slot.</para> |
| 304 |
</blockquote> |
| 305 |
<blockquote> |
| 306 |
<screen><indexterm role="fn"><primary>slot-missing</primary></indexterm>— Generic: <function>slot-missing</function> <varname>class</varname> <varname>object</varname> <varname>slot-name</varname> <varname>operation</varname> <varname>&optional</varname> <varname>new-value</varname></screen> |
| 307 |
<screen><indexterm role="fn"><primary>slot-missing</primary></indexterm>— Method: <function>slot-missing</function> (</screen> |
| 308 |
<para>The generic function slot-missing is invoked when an attempt is made to access |
| 309 |
a slot in an object whose metaclass is standard-class and the name of the slot |
| 310 |
provided is not a name of a slot in that class. The default method signals an |
| 311 |
error.</para> |
| 312 |
</blockquote> |
| 313 |
<blockquote> |
| 314 |
<screen><indexterm role="fn"><primary>slot-unbound</primary></indexterm>— Generic: <function>slot-unbound</function> <varname>class</varname> <varname>instance</varname> <varname>slot-name</varname></screen> |
| 315 |
<screen><indexterm role="fn"><primary>slot-unbound</primary></indexterm>— Method: <function>slot-unbound</function> (</screen> |
| 316 |
<para>The generic function slot-unbound is called when an unbound slot is read in an |
| 317 |
instance whose metaclass is standard-class. The default method signals an |
| 318 |
error.</para> |
| 319 |
</blockquote> |
| 320 |
<blockquote> |
| 321 |
<screen><indexterm role="fn"><primary>slot-value</primary></indexterm>— Function: <function>slot-value</function> <varname>object slot-name</varname></screen> |
| 322 |
<para>The function slot-value returns the value contained in the slot slot-name of |
| 323 |
the given object. If there is no slot with that name, slot-missing is called. |
| 324 |
If the slot is unbound, slot-unbound is called. The macro setf can be used |
| 325 |
with slot-value to change the value of a slot.</para> |
| 326 |
</blockquote> |
| 327 |
<blockquote> |
| 328 |
<screen><indexterm role="fn"><primary>update-instance-for-different-class</primary></indexterm>— Generic: <function>update-instance-for-different-class</function> <varname>previous</varname> <varname>current</varname> <varname>&rest</varname> <varname>initargs</varname></screen> |
| 329 |
<screen><indexterm role="fn"><primary>update-instance-for-different-class</primary></indexterm>— Method: <function>update-instance-for-different-class</function> (</screen> |
| 330 |
</blockquote> |
| 331 |
<blockquote> |
| 332 |
<screen><indexterm role="fn"><primary>update-instance-for-redefined-class</primary></indexterm>— Generic: <function>update-instance-for-redefined-class</function> <varname>instance</varname> <varname>added-slots</varname> <varname>discarded-slots</varname> <varname>property-list</varname> <varname>&rest</varname> <varname>initargs</varname></screen> |
| 333 |
<screen><indexterm role="fn"><primary>update-instance-for-redefined-class</primary></indexterm>— Method: <function>update-instance-for-redefined-class</function> (</screen> |
| 334 |
</blockquote> |
| 335 |
<blockquote> |
| 336 |
<screen><indexterm role="fn"><primary>with-accessors</primary></indexterm>— Macro: <function>with-accessors</function> (</screen> |
| 337 |
<para>The macro with-accessors creates a lexical environment in which specified slots |
| 338 |
are lexically available through their accessors as if they were variables. The |
| 339 |
macro with-accessors invokes the appropriate accessors to access the specified |
| 340 |
slots. Both setf and setq can be used to set the value of the slot. The |
| 341 |
result returned is that obtained by executing the forms specified by the body |
| 342 |
argument.</para> |
| 343 |
</blockquote> |
| 344 |
<blockquote> |
| 345 |
<screen><indexterm role="fn"><primary>with-slots</primary></indexterm>— Macro: <function>with-slots</function> (</screen> |
| 346 |
<screen> |
| 347 |
<replaceable>slot-entry</replaceable> ::= <replaceable>slot-name</replaceable> | (<replaceable>variable-name</replaceable> <replaceable>slot-name</replaceable>) |
| 348 |
</screen> |
| 349 |
<para>The macro <literal>with-slots</literal> creates a lexical context for referring to |
| 350 |
specified slots as though they were variables. Within such a context the value |
| 351 |
of the slot can be specified by using its slot name, as if it were a lexically |
| 352 |
bound variable. Both <literal>setf</literal> and <literal>setq</literal> can be used to set the value |
| 353 |
of the slot.</para> |
| 354 |
</blockquote> |
| 355 |
</chapter> |
| 356 |
<!-- Keep this comment at the end of the file |
| 357 |
Local variables: |
| 358 |
sgml-parent-document: "ecl.xml" |
| 359 |
sgml-indent-step: 1 |
| 360 |
nxml-child-indent: 1 |
| 361 |
nxml-outline-child-indent: 1 |
| 362 |
fill-column: 79 |
| 363 |
End: |
| 364 |
--></book> |