1.0.9: release, will be tagged as sbcl_1_0_9
[sbcl.git] / src / pcl / generic-functions.lisp
1 ;;;; Mostly this file contains generic functions. The exceptions are hacks.
2
3 ;;;; This software is part of the SBCL system. See the README file for
4 ;;;; more information.
5
6 ;;;; This software is in the public domain and is provided with absolutely no
7 ;;;; warranty. See the COPYING and CREDITS files for more information.
8
9 (in-package "SB-PCL")
10 \f
11 ;;;; class predicates
12
13 (defgeneric class-eq-specializer-p (object))
14
15 (defgeneric classp (object))
16
17 (defgeneric condition-class-p (object))
18
19 (defgeneric eql-specializer-p (object))
20
21 (defgeneric exact-class-specializer-p (object))
22
23 (defgeneric forward-referenced-class-p (object))
24
25 (defgeneric funcallable-standard-class-p (object))
26
27 (defgeneric generic-function-p (object))
28
29 (defgeneric method-combination-p (object))
30
31 (defgeneric method-p (object))
32
33 (defgeneric short-method-combination-p (object))
34
35 (defgeneric slot-class-p (object))
36
37 (defgeneric specializerp (object))
38
39 (defgeneric standard-accessor-method-p (object))
40
41 (defgeneric standard-boundp-method-p (object))
42
43 (defgeneric standard-class-p (object))
44
45 (defgeneric standard-generic-function-p (object))
46
47 (defgeneric standard-method-p (object))
48
49 (defgeneric standard-reader-method-p (object))
50
51 (defgeneric standard-writer-method-p (object))
52
53 (defgeneric structure-class-p (object))
54 \f
55 ;;;; readers
56
57 (defgeneric accessor-method-slot-definition (standard-accessor-method))
58
59 (defgeneric class-can-precede-list (pcl-class))
60
61 (defgeneric class-defstruct-constructor (structure-class))
62
63 (defgeneric class-defstruct-form (structure-class))
64
65 (defgeneric class-direct-subclasses (class))
66
67 (defgeneric class-direct-superclasses (class))
68
69 (defgeneric class-eq-specializer (class))
70
71 (defgeneric class-incompatible-superclass-list (pcl-class))
72
73 (defgeneric class-name (class))
74
75 (defgeneric class-precedence-list (pcl-class))
76
77 (defgeneric class-wrapper (pcl-class))
78
79 (defgeneric definition-source (definition-source-mixin))
80
81 (defgeneric eql-specializer-object (eql-specializer))
82
83 (defgeneric generic-function-declarations (standard-generic-function))
84
85 (defgeneric generic-function-method-class (standard-generic-function))
86
87 (defgeneric generic-function-method-combination (standard-generic-function))
88
89 (defgeneric generic-function-methods (standard-generic-function))
90
91 (defgeneric generic-function-name (standard-generic-function))
92
93 (defgeneric gf-arg-info (standard-generic-function))
94
95 (defgeneric gf-dfun-state (standard-generic-function))
96
97 (defgeneric generic-function-initial-methods (standard-generic-function))
98
99 (defgeneric long-method-combination-function (long-method-combination))
100
101 (defgeneric method-combination-documentation (standard-method-combination))
102
103 (defgeneric method-combination-options (standard-method-combination))
104
105 (defgeneric method-combination-type-name (standard-method-combination))
106
107 (defgeneric method-generic-function (standard-method))
108
109 (defgeneric object-plist (plist-mixin))
110
111 (defgeneric short-combination-identity-with-one-argument
112   (short-method-combination))
113
114 (defgeneric short-combination-operator (short-method-combination))
115
116 (defgeneric slot-definition-boundp-function (effective-slot-definition))
117
118 (defgeneric slot-definition-class (slot-definition))
119
120 (defgeneric slot-definition-defstruct-accessor-symbol
121   (structure-slot-definition))
122
123 (defgeneric slot-definition-initargs (slot-definition))
124
125 (defgeneric slot-definition-initform (slot-definition))
126
127 (defgeneric slot-definition-initfunction (slot-definition))
128
129 (defgeneric slot-definition-internal-reader-function
130   (structure-slot-definition))
131
132 (defgeneric slot-definition-internal-writer-function
133   (structure-slot-definition))
134
135 (defgeneric slot-definition-location (standard-effective-slot-definition))
136
137 (defgeneric slot-definition-name (slot-definition))
138
139 (defgeneric slot-definition-reader-function (effective-slot-definition))
140
141 (defgeneric slot-definition-readers (slot-definition))
142
143 (defgeneric slot-definition-type (slot-definition))
144
145 (defgeneric slot-definition-writer-function (effective-slot-definition))
146
147 (defgeneric slot-definition-writers (slot-definition))
148
149 (defgeneric specializer-object (class-eq-specializer))
150
151 (defgeneric specializer-type (specializer))
152 \f
153 ;;;; writers
154
155 (defgeneric (setf class-defstruct-constructor) (new-value structure-class))
156
157 (defgeneric (setf class-defstruct-form) (new-value structure-class))
158
159 (defgeneric (setf class-direct-slots) (new-value slot-class))
160
161 (defgeneric (setf class-incompatible-superclass-list) (new-value pcl-class))
162
163 (defgeneric (setf class-name) (new-value class))
164
165 (defgeneric (setf class-slots) (new-value slot-class))
166
167 (defgeneric (setf generic-function-method-class) (new-value
168                                                   standard-generic-function))
169
170 (defgeneric (setf generic-function-method-combination)
171   (new-value standard-generic-function))
172
173 (defgeneric (setf generic-function-declarations) (new-value
174                                                   standard-generic-function))
175
176 (defgeneric (setf generic-function-methods) (new-value
177                                              standard-generic-function))
178
179 (defgeneric (setf generic-function-name) (new-value standard-generic-function))
180
181 (defgeneric (setf gf-dfun-state) (new-value standard-generic-function))
182
183 (defgeneric (setf generic-function-initial-methods)
184   (new-value standard-generic-function))
185
186 (defgeneric (setf method-generic-function) (new-value standard-method))
187
188 (defgeneric (setf object-plist) (new-value plist-mixin))
189
190 (defgeneric (setf slot-definition-allocation) (new-value
191                                                standard-slot-definition))
192
193 (defgeneric (setf slot-definition-boundp-function)
194   (new-value effective-slot-definition))
195
196 (defgeneric (setf slot-definition-class) (new-value slot-definition))
197
198 (defgeneric (setf slot-definition-defstruct-accessor-symbol)
199   (new-value structure-slot-definition))
200
201 (defgeneric (setf slot-definition-initargs) (new-value slot-definition))
202
203 (defgeneric (setf slot-definition-initform) (new-value slot-definition))
204
205 (defgeneric (setf slot-definition-initfunction) (new-value slot-definition))
206
207 (defgeneric (setf slot-definition-internal-reader-function)
208   (new-value structure-slot-definition))
209
210 (defgeneric (setf slot-definition-internal-writer-function)
211   (new-value structure-slot-definition))
212
213 (defgeneric (setf slot-definition-location)
214   (new-value standard-effective-slot-definition))
215
216 (defgeneric (setf slot-definition-name) (new-value slot-definition))
217
218 (defgeneric (setf slot-definition-reader-function) (new-value
219                                                     effective-slot-definition))
220
221 (defgeneric (setf slot-definition-readers) (new-value slot-definition))
222
223 (defgeneric (setf slot-definition-type) (new-value slot-definition))
224
225 (defgeneric (setf slot-definition-writer-function)
226   (new-value effective-slot-definition))
227
228 (defgeneric (setf slot-definition-writers) (new-value slot-definition))
229 \f
230 ;;;; 1 argument
231
232 (defgeneric accessor-method-slot-name (m))
233
234 (defgeneric class-default-initargs (class))
235
236 (defgeneric class-direct-default-initargs (class))
237
238 (defgeneric class-direct-slots (class))
239
240 (defgeneric class-finalized-p (class))
241
242 (defgeneric class-prototype (class))
243
244 (defgeneric class-slot-cells (class))
245
246 (defgeneric class-slots (class))
247
248 (defgeneric compute-class-precedence-list (root))
249
250 (defgeneric compute-default-initargs (class))
251
252 (defgeneric compute-discriminating-function (gf))
253
254 (defgeneric compute-discriminating-function-arglist-info (generic-function))
255
256 (defgeneric compute-slots (class))
257
258 (defgeneric finalize-inheritance (class))
259
260 (defgeneric function-keyword-parameters (method))
261
262 (defgeneric generic-function-argument-precedence-order (gf))
263
264 (defgeneric generic-function-lambda-list (gf))
265
266 (defgeneric generic-function-pretty-arglist (generic-function))
267
268 (defgeneric gf-fast-method-function-p (gf))
269
270 (defgeneric initialize-internal-slot-functions (slotd))
271
272 (defgeneric make-instances-obsolete (class))
273
274 (defgeneric method-function (method))
275
276 (defgeneric method-lambda-list (m))
277
278 (defgeneric method-qualifiers (m))
279
280 (defgeneric method-specializers (m))
281
282 (defgeneric raw-instance-allocator (class))
283
284 (defgeneric slot-definition-allocation (slotd))
285
286 (defgeneric slots-fetcher (class))
287
288 (defgeneric specializer-class (specializer))
289
290 (defgeneric specializer-direct-generic-functions (specializer))
291
292 (defgeneric specializer-direct-methods (specializer))
293
294 (defgeneric specializer-method-table (specializer))
295
296 (defgeneric update-constructors (class))
297
298 (defgeneric wrapper-fetcher (class))
299 \f
300 ;;;; 2 arguments
301
302 (defgeneric add-dependent (metaobject dependent))
303
304 (defgeneric add-direct-method (specializer method))
305
306 (defgeneric add-direct-subclass (class subclass))
307
308 (defgeneric add-method (generic-function method))
309
310 (defgeneric (setf class-slot-cells) (new-value class))
311
312 (defgeneric class-slot-value (class slot-name))
313
314 (defgeneric compatible-meta-class-change-p (class proto-new-class))
315
316 (defgeneric compute-applicable-methods (generic-function arguments))
317
318 (defgeneric compute-applicable-methods-using-classes
319   (generic-function classes))
320
321 (defgeneric compute-effective-slot-definition-initargs (class direct-slotds))
322
323 (defgeneric describe-object (object stream))
324
325 (defgeneric direct-slot-definition-class (class &rest initargs))
326
327 (defgeneric effective-slot-definition-class (class &rest initargs))
328
329 (defgeneric make-boundp-method-function (class slot-name))
330
331 (defgeneric make-reader-method-function (class slot-name))
332
333 (defgeneric make-writer-method-function (class slot-name))
334
335 (defgeneric map-dependents (metaobject function))
336
337 (defgeneric parse-specializer-using-class (generic-function specializer-name))
338
339 (defgeneric remove-boundp-method (class generic-function))
340
341 (defgeneric remove-dependent (metaobject dependent))
342
343 (defgeneric remove-direct-method (specializer method))
344
345 (defgeneric remove-direct-subclass (class subclass))
346
347 (defgeneric remove-method (generic-function method))
348
349 (defgeneric remove-reader-method (class generic-function))
350
351 (defgeneric remove-writer-method (class generic-function))
352
353 (defgeneric same-specializer-p (specl1 specl2))
354
355 (defgeneric slot-accessor-function (slotd type))
356
357 (defgeneric slot-accessor-std-p (slotd type))
358
359 ;;; This controls DESCRIBE-OBJECT (SLOT-OBJECT STREAM) behavior.
360 (defgeneric slots-to-inspect (class object))
361
362 (defgeneric unparse-specializer-using-class (generic-function specializer))
363
364 (defgeneric update-gf-dfun (class gf))
365
366 (defgeneric validate-superclass (class superclass))
367
368 (defgeneric (setf documentation) (new-value slotd doc-type)
369   (:argument-precedence-order doc-type slotd new-value))
370
371 (defgeneric documentation (slotd doc-type)
372   (:argument-precedence-order doc-type slotd))
373 \f
374 ;;;; 3 arguments
375
376 (defgeneric (setf class-slot-value) (nv class slot-name))
377
378 ;;; CMUCL comment (from Gerd Moellmann/Pierre Mai, 2002-10-19):
379 ;;;
380 ;;; According to AMOP, COMPUTE-EFFECTIVE-METHOD should return two
381 ;;; values.  Alas, the second value is only vaguely described in AMOP,
382 ;;; and, when asked on 2002-10-18, Gregor Kiczales said he couldn't
383 ;;; remember what the second value was supposed to be.  So, PCL's
384 ;;; COMPUTE-EFFECTIVE-METHOD returns one value as do Allegro and
385 ;;; Lispworks.
386 (defgeneric compute-effective-method (generic-function
387                                       combin
388                                       applicable-methods))
389
390 (defgeneric compute-effective-slot-definition (class name dslotds))
391
392 (defgeneric compute-slot-accessor-info (slotd type gf))
393
394 (defgeneric default-initargs (class initargs defaults))
395
396 (defgeneric find-method-combination (generic-function type options))
397
398 (defgeneric invalid-qualifiers (generic-function combin method))
399
400 (defgeneric (setf slot-accessor-function) (function slotd type))
401
402 (defgeneric (setf slot-accessor-std-p) (value slotd type))
403
404 (defgeneric slot-boundp-using-class (class object slotd))
405
406 (defgeneric slot-makunbound-using-class (class object slotd))
407
408 (defgeneric slot-unbound (class instance slot-name))
409
410 (defgeneric slot-value-using-class (class object slotd))
411 \f
412 ;;;; 4 arguments
413
414 (defgeneric add-boundp-method (class generic-function slot-name slot-documentation))
415
416 (defgeneric add-reader-method (class generic-function slot-name slot-documentation))
417
418 (defgeneric add-writer-method (class generic-function slot-name slot-documentation))
419
420 (defgeneric make-method-lambda
421     (proto-generic-function proto-method lambda-expression environment))
422
423 (defgeneric make-method-specializers-form
424     (proto-generic-function proto-method specializer-names environment))
425
426 (defgeneric (setf slot-value-using-class) (new-value class object slotd))
427 \f
428 ;;;; 5 arguments
429
430 (defgeneric make-method-initargs-form
431     (proto-generic-function proto-method lambda-expression lambda-list
432      environment))
433 \f
434 ;;;; optional arguments
435
436 (defgeneric get-method (generic-function
437                         qualifiers
438                         specializers
439                         &optional errorp))
440
441 (defgeneric find-method (generic-function
442                          qualifiers
443                          specializers
444                          &optional errorp))
445
446 (defgeneric slot-missing (class
447                           instance
448                           slot-name
449                           operation
450                           &optional new-value))
451 \f
452 ;;;; &KEY arguments
453
454 ;;; FIXME: make the declared &KEY arguments here agree with those that
455 ;;; AMOP specifies.
456 (defgeneric allocate-instance (class &rest initargs))
457
458 (defgeneric ensure-class-using-class (class
459                                       name
460                                       &rest args
461                                       &key &allow-other-keys))
462
463 (defgeneric ensure-generic-function-using-class (generic-function
464                                                  fun-name
465                                                  &key &allow-other-keys))
466
467 (defgeneric initialize-instance (gf &key &allow-other-keys))
468
469 (defgeneric make-instance (class &rest initargs &key &allow-other-keys))
470
471 (defgeneric change-class (instance new-class-name &rest initargs &key &allow-other-keys))
472
473 (defgeneric no-applicable-method (generic-function &rest args))
474
475 (defgeneric no-next-method (generic-function method &rest args))
476
477 (defgeneric no-primary-method (generic-function &rest args))
478
479 (defgeneric reader-method-class (class direct-slot &rest initargs))
480
481 (defgeneric reinitialize-instance (gf &rest args &key &allow-other-keys))
482
483 (defgeneric shared-initialize (generic-function
484                                slot-names
485                                &key &allow-other-keys))
486
487 (defgeneric update-dependent (metaobject dependent &rest initargs))
488
489 (defgeneric update-instance-for-different-class (previous
490                                                  current
491                                                  &rest initargs))
492
493 (defgeneric update-instance-for-redefined-class (instance
494                                                  added-slots
495                                                  discarded-slots
496                                                  property-list
497                                                  &rest initargs))
498
499 (defgeneric writer-method-class (class direct-slot &rest initargs))