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