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
11;;;; readers
12
13(defgeneric accessor-method-slot-definition (standard-accessor-method))
14
15(defgeneric class-can-precede-list (pcl-class))
16
17(defgeneric class-defstruct-constructor (structure-class))
18
19(defgeneric class-defstruct-form (structure-class))
20
21(defgeneric class-direct-subclasses (class))
22
23(defgeneric class-direct-superclasses (class))
24
25(defgeneric class-eq-specializer (class))
26
27(defgeneric class-incompatible-superclass-list (pcl-class))
28
29(defgeneric class-name (class))
30
31(defgeneric class-precedence-list (pcl-class))
32
33(defgeneric class-wrapper (pcl-class))
34
35(defgeneric definition-source (definition-source-mixin))
36
37(defgeneric eql-specializer-object (eql-specializer))
38
39(defgeneric generic-function-declarations (standard-generic-function))
40
41(defgeneric generic-function-method-class (standard-generic-function))
42
43(defgeneric generic-function-method-combination (standard-generic-function))
44
45(defgeneric generic-function-methods (standard-generic-function))
46
47(defgeneric generic-function-name (standard-generic-function))
48
49(defgeneric gf-arg-info (standard-generic-function))
50
51(defgeneric gf-dfun-state (standard-generic-function))
52
53(defgeneric generic-function-initial-methods (standard-generic-function))
54
55(defgeneric long-method-combination-function (long-method-combination))
56
57(defgeneric method-combination-documentation (standard-method-combination))
58
59(defgeneric method-combination-options (standard-method-combination))
60
61(defgeneric method-combination-type-name (standard-method-combination))
62
63(defgeneric method-generic-function (standard-method))
64
65(defgeneric object-plist (plist-mixin))
66
67(defgeneric short-combination-identity-with-one-argument
68  (short-method-combination))
69
70(defgeneric short-combination-operator (short-method-combination))
71
72(defgeneric slot-definition-class (slot-definition))
73
74(defgeneric slot-definition-defstruct-accessor-symbol
75  (structure-slot-definition))
76
77(defgeneric slot-definition-initargs (slot-definition))
78
79(defgeneric slot-definition-initform (slot-definition))
80
81(defgeneric slot-definition-initfunction (slot-definition))
82
83(defgeneric slot-definition-internal-reader-function
84  (structure-slot-definition))
85
86(defgeneric slot-definition-internal-writer-function
87  (structure-slot-definition))
88
89(defgeneric slot-definition-location (standard-effective-slot-definition))
90
91(defgeneric slot-definition-name (slot-definition))
92
93(defgeneric slot-definition-info (effective-slot-definition))
94
95(defgeneric slot-definition-readers (slot-definition))
96
97(defgeneric slot-definition-type (slot-definition))
98
99(defgeneric slot-definition-writers (slot-definition))
100
101(defgeneric specializer-object (class-eq-specializer))
102
103(defgeneric specializer-type (specializer))
104
105;;;; writers
106
107(defgeneric (setf class-defstruct-constructor) (new-value structure-class))
108
109(defgeneric (setf class-defstruct-form) (new-value structure-class))
110
111(defgeneric (setf class-direct-slots) (new-value slot-class))
112
113(defgeneric (setf class-incompatible-superclass-list) (new-value pcl-class))
114
115(defgeneric (setf class-name) (new-value class))
116
117(defgeneric (setf class-slots) (new-value slot-class))
118
119(defgeneric (setf generic-function-method-class) (new-value
120                                                  standard-generic-function))
121
122(defgeneric (setf generic-function-method-combination)
123  (new-value standard-generic-function))
124
125(defgeneric (setf generic-function-declarations) (new-value
126                                                  standard-generic-function))
127
128(defgeneric (setf generic-function-methods) (new-value
129                                             standard-generic-function))
130
131(defgeneric (setf generic-function-name) (new-value standard-generic-function))
132
133(defgeneric (setf gf-dfun-state) (new-value standard-generic-function))
134
135(defgeneric (setf generic-function-initial-methods)
136  (new-value standard-generic-function))
137
138(defgeneric (setf method-generic-function) (new-value standard-method))
139
140(defgeneric (setf object-plist) (new-value plist-mixin))
141
142(defgeneric (setf slot-definition-allocation) (new-value
143                                               standard-slot-definition))
144
145(defgeneric (setf slot-definition-class) (new-value slot-definition))
146
147(defgeneric (setf slot-definition-defstruct-accessor-symbol)
148  (new-value structure-slot-definition))
149
150(defgeneric (setf slot-definition-initargs) (new-value slot-definition))
151
152(defgeneric (setf slot-definition-initform) (new-value slot-definition))
153
154(defgeneric (setf slot-definition-initfunction) (new-value slot-definition))
155
156(defgeneric (setf slot-definition-internal-reader-function)
157  (new-value structure-slot-definition))
158
159(defgeneric (setf slot-definition-internal-writer-function)
160  (new-value structure-slot-definition))
161
162(defgeneric (setf slot-definition-location)
163  (new-value standard-effective-slot-definition))
164
165(defgeneric (setf slot-definition-name) (new-value slot-definition))
166
167(defgeneric (setf slot-definition-info) (new-value effective-slot-definition))
168
169(defgeneric (setf slot-definition-readers) (new-value slot-definition))
170
171(defgeneric (setf slot-definition-type) (new-value slot-definition))
172
173(defgeneric (setf slot-definition-writer-function)
174  (new-value effective-slot-definition))
175
176(defgeneric (setf slot-definition-writers) (new-value slot-definition))
177
178;;;; 1 argument
179
180(defgeneric accessor-method-slot-name (m))
181
182(defgeneric class-default-initargs (class))
183
184(defgeneric class-direct-default-initargs (class))
185
186(defgeneric class-direct-slots (class))
187
188(defgeneric class-finalized-p (class))
189
190(defgeneric class-prototype (class))
191
192(defgeneric class-slot-cells (class))
193
194(defgeneric class-slots (class))
195
196(defgeneric compute-class-precedence-list (root))
197
198(defgeneric compute-default-initargs (class))
199
200(defgeneric compute-discriminating-function (gf))
201
202(defgeneric compute-discriminating-function-arglist-info (generic-function))
203
204(defgeneric compute-slots (class))
205
206(defgeneric finalize-inheritance (class))
207
208(defgeneric function-keywords (method))
209
210(defgeneric generic-function-argument-precedence-order (gf))
211
212(defgeneric generic-function-lambda-list (gf))
213
214(defgeneric generic-function-pretty-arglist (generic-function))
215
216(defgeneric gf-fast-method-function-p (gf))
217
218(defgeneric initialize-internal-slot-functions (slotd))
219
220(defgeneric make-instances-obsolete (class))
221
222(defgeneric method-function (method))
223
224(defgeneric method-lambda-list (m))
225
226(defgeneric method-qualifiers (m))
227
228(defgeneric method-specializers (m))
229
230(defgeneric raw-instance-allocator (class))
231
232(defgeneric slot-definition-allocation (slotd))
233
234(defgeneric slots-fetcher (class))
235
236(defgeneric specializer-class (specializer))
237
238(defgeneric specializer-direct-generic-functions (specializer))
239
240(defgeneric specializer-direct-methods (specializer))
241
242(defgeneric specializer-method-table (specializer))
243
244(defgeneric specializer-method-holder (specializer &optional create))
245
246(defgeneric update-constructors (class))
247
248(defgeneric wrapper-fetcher (class))
249
250;;;; 2 arguments
251
252(defgeneric add-dependent (metaobject dependent))
253
254(defgeneric add-direct-method (specializer method))
255
256(defgeneric add-direct-subclass (class subclass))
257
258(defgeneric add-method (generic-function method))
259
260(defgeneric (setf class-slot-cells) (new-value class))
261
262(defgeneric class-slot-value (class slot-name))
263
264(defgeneric compatible-meta-class-change-p (class proto-new-class))
265
266(defgeneric compute-applicable-methods (generic-function arguments))
267
268(defgeneric compute-applicable-methods-using-classes
269  (generic-function classes))
270
271(defgeneric compute-effective-slot-definition-initargs (class direct-slotds))
272
273(defgeneric describe-object (object stream))
274
275(defgeneric direct-slot-definition-class (class &rest initargs))
276
277(defgeneric effective-slot-definition-class (class &rest initargs))
278
279(defgeneric make-boundp-method-function (class slot-name))
280
281(defgeneric make-reader-method-function (class slot-name))
282
283(defgeneric make-writer-method-function (class slot-name))
284
285(defgeneric map-dependents (metaobject function))
286
287(defgeneric parse-specializer-using-class (generic-function specializer-name))
288
289(defgeneric remove-boundp-method (class generic-function))
290
291(defgeneric remove-dependent (metaobject dependent))
292
293(defgeneric remove-direct-method (specializer method))
294
295(defgeneric remove-direct-subclass (class subclass))
296
297(defgeneric remove-method (generic-function method))
298
299(defgeneric remove-reader-method (class generic-function))
300
301(defgeneric remove-writer-method (class generic-function))
302
303(defgeneric same-specializer-p (specl1 specl2))
304
305(defgeneric slot-accessor-function (slotd type))
306
307(defgeneric slot-accessor-std-p (slotd type))
308
309;;; This controls DESCRIBE-OBJECT (SLOT-OBJECT STREAM) behavior.
310(defgeneric slots-to-inspect (class object))
311
312(defgeneric unparse-specializer-using-class (generic-function specializer))
313
314(defgeneric validate-superclass (class superclass))
315
316(defgeneric invalid-superclass (class superclass))
317
318(defgeneric (setf documentation) (new-value slotd doc-type)
319  (:argument-precedence-order doc-type slotd new-value))
320
321(defgeneric documentation (slotd doc-type)
322  (:argument-precedence-order doc-type slotd))
323
324;;;; 3 arguments
325
326(defgeneric (setf class-slot-value) (nv class slot-name))
327
328;;; CMUCL comment (from Gerd Moellmann/Pierre Mai, 2002-10-19):
329;;;
330;;; According to AMOP, COMPUTE-EFFECTIVE-METHOD should return two
331;;; values.  Alas, the second value is only vaguely described in AMOP,
332;;; and, when asked on 2002-10-18, Gregor Kiczales said he couldn't
333;;; remember what the second value was supposed to be.  So, PCL's
334;;; COMPUTE-EFFECTIVE-METHOD returns one value as do Allegro and
335;;; Lispworks.
336(defgeneric compute-effective-method (generic-function
337                                      combin
338                                      applicable-methods))
339
340(defgeneric compute-effective-slot-definition (class name dslotds))
341
342(defgeneric compute-slot-accessor-info (slotd type gf))
343
344(defgeneric find-method-combination (generic-function type options))
345
346(defgeneric invalid-qualifiers (generic-function combin method))
347
348(defgeneric (setf slot-accessor-function) (function slotd type))
349
350(defgeneric (setf slot-accessor-std-p) (value slotd type))
351
352(defgeneric slot-boundp-using-class (class object slotd))
353
354(defgeneric slot-makunbound-using-class (class object slotd))
355
356(defgeneric slot-unbound (class instance slot-name))
357
358(defgeneric slot-value-using-class (class object slotd))
359
360;;;; 4 arguments
361
362(defgeneric make-method-lambda
363    (proto-generic-function proto-method lambda-expression environment))
364
365(defgeneric make-method-specializers-form
366    (proto-generic-function proto-method specializer-names environment))
367
368;;; MAKE-SPECIALIZER-FORM-USING-CLASS
369;;;
370;;; To free every new custom generic function class from having to
371;;; implement iteration over specializers in
372;;; MAKE-METHOD-SPECIALIZERS-FORM, we provide a default method
373;;;
374;;;   make-method-specializers-form standard-g-f standard-method
375;;;
376;;; which performs this iteration and calls the generic function
377;;;
378;;;   make-specializer-form-using-class proto-g-f proto-m specializer-name env
379;;;
380;;; on which custom generic function classes can install methods to
381;;; handle their custom specializers. The generic function uses OR
382;;; method combination to allow the following idiom:
383;;;
384;;;   (defmethod make-specializer-form-using-class or
385;;;       (proto-generic-function MY-GENERIC-FUNCTION)
386;;;       (proto-method standard-method)
387;;;       (specializer-name cons)
388;;;       (environment t))
389;;;     (when (typep specializer-name '(cons (eql MY-SPECIALIZER)))
390;;;       MY-SPECIALIZER-FORM))
391;;;
392;;; The OR method combination lets everything but (my-specializer ...)
393;;; fall through to the next methods which will, at some point, handle
394;;; class and eql specializers and eventually reach an error signaling
395;;; method for invalid specializers.
396
397(defgeneric make-specializer-form-using-class
398    (proto-generic-function proto-method specializer-name environment)
399  (:method-combination or)
400  #+sb-doc
401  (:documentation
402   "Return a form which, when evaluated in the lexical environment
403described by ENVIRONMENT, parses the specializer SPECIALIZER-NAME and
404yields the appropriate specializer object.
405
406Both PROTO-GENERIC-FUNCTION and PROTO-METHOD may be
407uninitialized. However their classes and prototypes can be
408inspected.
409
410NOTE: This generic function is part of an SBCL-specific experimental
411protocol. Interface subject to change."))
412
413(defgeneric (setf slot-value-using-class) (new-value class object slotd))
414
415;;;; 5 arguments
416
417;;; FIXME: This is currently unused -- where should we call it? Or should we just
418;;; delete it.
419(defgeneric add-boundp-method (class generic-function slot-name slot-documentation source-location))
420
421(defgeneric add-reader-method (class generic-function slot-name slot-documentation source-location))
422
423(defgeneric add-writer-method (class generic-function slot-name slot-documentation source-location))
424
425(defgeneric make-method-initargs-form
426    (proto-generic-function proto-method lambda-expression lambda-list
427     environment))
428
429;;;; 6 arguments
430
431(defgeneric make-method-lambda-using-specializers
432    (proto-generic-function proto-method qualifiers specializers
433     method-lambda environment)
434  #+sb-doc
435  (:documentation
436   "Compute a method lambda form based on METHOD-LAMBDA, possibly
437taking into account PROTO-GENERIC-FUNCTION, PROTO-METHOD, QUALIFIERS,
438SPECIALIZERS and ENVIRONMENT.
439
440Both PROTO-GENERIC-FUNCTION and PROTO-METHOD may be
441uninitialized. However, their classes and prototypes can be inspected.
442
443SPECIALIZERS is a list of specializer objects (i.e. parsed).
444
445Return three values:
4461. the created method lambda form
4472. initargs for the method instance
4483. a (possibly modified) unspecialized method lambda list or nil if
449   the unspecialized lambda list contained in METHOD-LAMBDA should be
450   used
451
452NOTE: This generic function is part of an SBCL-specific experimental
453protocol. Interface subject to change."))
454
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
473;;;; &KEY arguments
474
475;;; FIXME: make the declared &KEY arguments here agree with those that
476;;; AMOP specifies.
477(defgeneric allocate-instance (class &rest initargs))
478
479(defgeneric ensure-class-using-class (class
480                                      name
481                                      &rest args
482                                      &key &allow-other-keys))
483
484(defgeneric ensure-generic-function-using-class (generic-function
485                                                 fun-name
486                                                 &key &allow-other-keys))
487
488(defgeneric initialize-instance (instance &rest initargs &key &allow-other-keys))
489
490(defgeneric make-instance (class &rest initargs &key &allow-other-keys))
491
492(defgeneric change-class (instance new-class-name &rest initargs &key &allow-other-keys))
493
494(defgeneric no-applicable-method (generic-function &rest args))
495
496(defgeneric no-next-method (generic-function method &rest args))
497
498(defgeneric no-primary-method (generic-function &rest args))
499
500(defgeneric reader-method-class (class direct-slot &rest initargs))
501
502(defgeneric reinitialize-instance (instance &rest initargs &key &allow-other-keys))
503
504(defgeneric shared-initialize (instance slot-names &rest initargs
505                               &key &allow-other-keys))
506
507(defgeneric update-dependent (metaobject dependent &rest initargs))
508
509(defgeneric update-instance-for-different-class (previous
510                                                 current
511                                                 &rest initargs))
512
513(defgeneric update-instance-for-redefined-class (instance
514                                                 added-slots
515                                                 discarded-slots
516                                                 property-list
517                                                 &rest initargs))
518
519(defgeneric writer-method-class (class direct-slot &rest initargs))
520