1.0.6.12: Improve user-subclassed SB-MOP:SPECIALIZER support
[sbcl.git] / src / pcl / defs.lisp
1 ;;;; This software is part of the SBCL system. See the README file for
2 ;;;; more information.
3
4 ;;;; This software is derived from software originally released by Xerox
5 ;;;; Corporation. Copyright and release statements follow. Later modifications
6 ;;;; to the software are in the public domain and are provided with
7 ;;;; absolutely no warranty. See the COPYING and CREDITS files for more
8 ;;;; information.
9
10 ;;;; copyright information from original PCL sources:
11 ;;;;
12 ;;;; Copyright (c) 1985, 1986, 1987, 1988, 1989, 1990 Xerox Corporation.
13 ;;;; All rights reserved.
14 ;;;;
15 ;;;; Use and copying of this software and preparation of derivative works based
16 ;;;; upon this software are permitted. Any distribution of this software or
17 ;;;; derivative works must comply with all applicable United States export
18 ;;;; control laws.
19 ;;;;
20 ;;;; This software is made available AS IS, and Xerox Corporation makes no
21 ;;;; warranty about the software, its performance or its conformity to any
22 ;;;; specification.
23
24 (in-package "SB-PCL")
25 \f
26 ;;; (These are left over from the days when PCL was an add-on package
27 ;;; for a pre-CLOS Common Lisp. They shouldn't happen in a normal
28 ;;; build, of course, but they might happen if someone is experimenting
29 ;;; and debugging, and it's probably worth complaining if they do,
30 ;;; so we've left 'em in.)
31 (when (eq *boot-state* 'complete)
32   (error "Trying to load (or compile) PCL in an environment in which it~%~
33           has already been loaded. This doesn't work, you will have to~%~
34           get a fresh lisp (reboot) and then load PCL."))
35 (when *boot-state*
36   (cerror "Try loading (or compiling) PCL anyways."
37           "Trying to load (or compile) PCL in an environment in which it~%~
38            has already been partially loaded. This may not work, you may~%~
39            need to get a fresh lisp (reboot) and then load PCL."))
40 \f
41 #-sb-fluid (declaim (inline gdefinition))
42 (defun gdefinition (spec)
43   ;; This is null layer right now, but once FDEFINITION stops bypasssing
44   ;; fwrappers/encapsulations we can do that here.
45   (fdefinition spec))
46
47 (defun (setf gdefinition) (new-value spec)
48   ;; This is almost a null layer right now, but once (SETF
49   ;; FDEFINITION) stops bypasssing fwrappers/encapsulations we can do
50   ;; that here.
51   (sb-c::note-name-defined spec :function) ; FIXME: do we need this? Why?
52   (setf (fdefinition spec) new-value))
53 \f
54 ;;;; type specifier hackery
55
56 ;;; internal to this file
57 (defun coerce-to-class (class &optional make-forward-referenced-class-p)
58   (if (symbolp class)
59       (or (find-class class (not make-forward-referenced-class-p))
60           (ensure-class class))
61       class))
62
63 ;;; interface
64 (defun specializer-from-type (type &aux args)
65   (when (symbolp type)
66     (return-from specializer-from-type (find-class type)))
67   (when (consp type)
68     (setq args (cdr type) type (car type)))
69   (cond ((symbolp type)
70          (or (ecase type
71                (class    (coerce-to-class (car args)))
72                (prototype (make-instance 'class-prototype-specializer
73                                          :object (coerce-to-class (car args))))
74                (class-eq (class-eq-specializer (coerce-to-class (car args))))
75                (eql      (intern-eql-specializer (car args))))))
76         ;; FIXME: do we still need this?
77         ((and (null args) (typep type 'classoid))
78          (or (classoid-pcl-class type)
79              (ensure-non-standard-class (classoid-name type))))
80         ((specializerp type) type)))
81
82 ;;; interface
83 (defun type-from-specializer (specl)
84   (cond ((eq specl t)
85          t)
86         ((consp specl)
87          (unless (member (car specl) '(class prototype class-eq eql))
88            (error "~S is not a legal specializer type." specl))
89          specl)
90         ((progn
91            (when (symbolp specl)
92              ;;maybe (or (find-class specl nil) (ensure-class specl)) instead?
93              (setq specl (find-class specl)))
94            (or (not (eq *boot-state* 'complete))
95                (specializerp specl)))
96          (specializer-type specl))
97         (t
98          (error "~S is neither a type nor a specializer." specl))))
99
100 (defun type-class (type)
101   (declare (special *the-class-t*))
102   (setq type (type-from-specializer type))
103   (if (atom type)
104       (if (eq type t)
105           *the-class-t*
106           (error "bad argument to TYPE-CLASS"))
107       (case (car type)
108         (eql (class-of (cadr type)))
109         (prototype (class-of (cadr type))) ;?
110         (class-eq (cadr type))
111         (class (cadr type)))))
112
113 (defun class-eq-type (class)
114   (specializer-type (class-eq-specializer class)))
115
116 ;;; internal to this file..
117 ;;;
118 ;;; These functions are a pale imitation of their namesake. They accept
119 ;;; class objects or types where they should.
120 (defun *normalize-type (type)
121   (cond ((consp type)
122          (if (member (car type) '(not and or))
123              `(,(car type) ,@(mapcar #'*normalize-type (cdr type)))
124              (if (null (cdr type))
125                  (*normalize-type (car type))
126                  type)))
127         ((symbolp type)
128          (let ((class (find-class type nil)))
129            (if class
130                (let ((type (specializer-type class)))
131                  (if (listp type) type `(,type)))
132                `(,type))))
133         ((or (not (eq *boot-state* 'complete))
134              (specializerp type))
135          (specializer-type type))
136         (t
137          (error "~S is not a type." type))))
138
139 ;;; internal to this file...
140 (defun convert-to-system-type (type)
141   (case (car type)
142     ((not and or) `(,(car type) ,@(mapcar #'convert-to-system-type
143                                           (cdr type))))
144     ((class class-eq) ; class-eq is impossible to do right
145      (layout-classoid (class-wrapper (cadr type))))
146     (eql type)
147     (t (if (null (cdr type))
148            (car type)
149            type))))
150
151 ;;; Writing the missing NOT and AND clauses will improve the quality
152 ;;; of code generated by GENERATE-DISCRIMINATION-NET, but calling
153 ;;; SUBTYPEP in place of just returning (VALUES NIL NIL) can be very
154 ;;; slow. *SUBTYPEP is used by PCL itself, and must be fast.
155 ;;;
156 ;;; FIXME: SB-KERNEL has fast-and-not-quite-precise type code for use
157 ;;; in the compiler. Could we share some of it here?
158 (defun *subtypep (type1 type2)
159   (if (equal type1 type2)
160       (values t t)
161       (if (eq *boot-state* 'early)
162           (values (eq type1 type2) t)
163           (let ((*in-precompute-effective-methods-p* t))
164             (declare (special *in-precompute-effective-methods-p*))
165             ;; FIXME: *IN-PRECOMPUTE-EFFECTIVE-METHODS-P* is not a
166             ;; good name. It changes the way
167             ;; CLASS-APPLICABLE-USING-CLASS-P works.
168             (setq type1 (*normalize-type type1))
169             (setq type2 (*normalize-type type2))
170             (case (car type2)
171               (not
172                (values nil nil)) ; XXX We should improve this.
173               (and
174                (values nil nil)) ; XXX We should improve this.
175               ((eql wrapper-eq class-eq class)
176                (multiple-value-bind (app-p maybe-app-p)
177                    (specializer-applicable-using-type-p type2 type1)
178                  (values app-p (or app-p (not maybe-app-p)))))
179               (t
180                (subtypep (convert-to-system-type type1)
181                          (convert-to-system-type type2))))))))
182 \f
183 (defvar *built-in-class-symbols* ())
184 (defvar *built-in-wrapper-symbols* ())
185
186 (defun get-built-in-class-symbol (class-name)
187   (or (cadr (assq class-name *built-in-class-symbols*))
188       (let ((symbol (make-class-symbol class-name)))
189         (push (list class-name symbol) *built-in-class-symbols*)
190         symbol)))
191
192 (defun get-built-in-wrapper-symbol (class-name)
193   (or (cadr (assq class-name *built-in-wrapper-symbols*))
194       (let ((symbol (make-wrapper-symbol class-name)))
195         (push (list class-name symbol) *built-in-wrapper-symbols*)
196         symbol)))
197 \f
198 (pushnew '%class *var-declarations*)
199 (pushnew '%variable-rebinding *var-declarations*)
200
201 (defun variable-class (var env)
202   (caddr (var-declaration 'class var env)))
203
204 (defvar *standard-method-combination*)
205 \f
206 (defun plist-value (object name)
207   (getf (object-plist object) name))
208
209 (defun (setf plist-value) (new-value object name)
210   (if new-value
211       (setf (getf (object-plist object) name) new-value)
212       (progn
213         (remf (object-plist object) name)
214         nil)))
215 \f
216 ;;;; built-in classes
217
218 ;;; Grovel over SB-KERNEL::*BUILT-IN-CLASSES* in order to set
219 ;;; SB-PCL:*BUILT-IN-CLASSES*.
220 (/show "about to set up SB-PCL::*BUILT-IN-CLASSES*")
221 (defvar *built-in-classes*
222   (labels ((direct-supers (class)
223              (/noshow "entering DIRECT-SUPERS" (classoid-name class))
224              (if (typep class 'built-in-classoid)
225                  (built-in-classoid-direct-superclasses class)
226                  (let ((inherits (layout-inherits
227                                   (classoid-layout class))))
228                    (/noshow inherits)
229                    (list (svref inherits (1- (length inherits)))))))
230            (direct-subs (class)
231              (/noshow "entering DIRECT-SUBS" (classoid-name class))
232              (collect ((res))
233                (let ((subs (classoid-subclasses class)))
234                  (/noshow subs)
235                  (when subs
236                    (dohash (sub v subs)
237                      (declare (ignore v))
238                      (/noshow sub)
239                      (when (member class (direct-supers sub))
240                        (res sub)))))
241                (res))))
242     (mapcar (lambda (kernel-bic-entry)
243               (/noshow "setting up" kernel-bic-entry)
244               (let* ((name (car kernel-bic-entry))
245                      (class (find-classoid name))
246                      (prototype-form
247                       (getf (cdr kernel-bic-entry) :prototype-form)))
248                 (/noshow name class)
249                 `(,name
250                   ,(mapcar #'classoid-name (direct-supers class))
251                   ,(mapcar #'classoid-name (direct-subs class))
252                   ,(map 'list
253                         (lambda (x)
254                           (classoid-name
255                            (layout-classoid x)))
256                         (reverse
257                          (layout-inherits
258                           (classoid-layout class))))
259                   ,(if prototype-form
260                        (eval prototype-form)
261                        ;; This is the default prototype value which
262                        ;; was used, without explanation, by the CMU CL
263                        ;; code we're derived from. Evidently it's safe
264                        ;; in all relevant cases.
265                        42))))
266             (remove-if (lambda (kernel-bic-entry)
267                          (member (first kernel-bic-entry)
268                                  ;; I'm not sure why these are removed from
269                                  ;; the list, but that's what the original
270                                  ;; CMU CL code did. -- WHN 20000715
271                                  '(t function stream
272                                      file-stream string-stream)))
273                        sb-kernel::*built-in-classes*))))
274 (/noshow "done setting up SB-PCL::*BUILT-IN-CLASSES*")
275 \f
276 ;;;; the classes that define the kernel of the metabraid
277
278 (defclass t () ()
279   (:metaclass built-in-class))
280
281 (defclass function (t) ()
282   (:metaclass built-in-class))
283
284 (defclass stream (t) ()
285   (:metaclass built-in-class))
286
287 (defclass file-stream (stream) ()
288   (:metaclass built-in-class))
289
290 (defclass string-stream (stream) ()
291   (:metaclass built-in-class))
292
293 (defclass slot-object (t) ()
294   (:metaclass slot-class))
295
296 (defclass condition (slot-object) ()
297   (:metaclass condition-class))
298
299 (defclass structure-object (slot-object) ()
300   (:metaclass structure-class))
301
302 (defstruct (dead-beef-structure-object
303             (:constructor |STRUCTURE-OBJECT class constructor|)
304             (:copier nil)))
305
306 (defclass standard-object (slot-object) ())
307
308 (defclass funcallable-standard-object (function standard-object)
309   ()
310   (:metaclass funcallable-standard-class))
311
312 (defclass metaobject (standard-object) ())
313
314 (defclass generic-function (dependent-update-mixin
315                             definition-source-mixin
316                             metaobject
317                             funcallable-standard-object)
318   ((%documentation
319     :initform nil
320     :initarg :documentation)
321    ;; We need to make a distinction between the methods initially set
322    ;; up by :METHOD options to DEFGENERIC and the ones set up later by
323    ;; DEFMETHOD, because ANSI specifies that executing DEFGENERIC on
324    ;; an already-DEFGENERICed function clears the methods set by the
325    ;; previous DEFGENERIC, but not methods set by DEFMETHOD. (Making
326    ;; this distinction seems a little kludgy, but it has the positive
327    ;; effect of making it so that loading a file a.lisp containing
328    ;; DEFGENERIC, then loading a second file b.lisp containing
329    ;; DEFMETHOD, then modifying and reloading a.lisp and/or b.lisp
330    ;; tends to leave the generic function in a state consistent with
331    ;; the most-recently-loaded state of a.lisp and b.lisp.)
332    (initial-methods
333     :initform ()
334     :accessor generic-function-initial-methods))
335   (:metaclass funcallable-standard-class))
336
337 (defclass standard-generic-function (generic-function)
338   ((name
339     :initform nil
340     :initarg :name
341     :reader generic-function-name)
342    (methods
343     :initform ()
344     :accessor generic-function-methods
345     :type list)
346    (method-class
347     :initarg :method-class
348     :accessor generic-function-method-class)
349    (%method-combination
350     :initarg :method-combination
351     :accessor generic-function-method-combination)
352    (declarations
353     ;; KLUDGE: AMOP specifies :DECLARATIONS, while ANSI specifies
354     ;; :DECLARE.  Allow either (but FIXME: maybe a note or a warning
355     ;; might be appropriate).
356     :initarg :declarations
357     :initarg :declare
358     :initform ()
359     :accessor generic-function-declarations)
360    (arg-info
361     :initform (make-arg-info)
362     :reader gf-arg-info)
363    (dfun-state
364     :initform ()
365     :accessor gf-dfun-state)
366    ;; Used to make DFUN-STATE & FIN-FUNCTION updates atomic.
367    (%lock
368     :initform (sb-thread::make-spinlock :name "GF lock")
369     :reader gf-lock))
370   (:metaclass funcallable-standard-class)
371   (:default-initargs :method-class *the-class-standard-method*
372                      :method-combination *standard-method-combination*))
373
374 (defclass method (metaobject) ())
375
376 (defclass standard-method (plist-mixin definition-source-mixin method)
377   ((%generic-function :initform nil :accessor method-generic-function)
378    (qualifiers :initform () :initarg :qualifiers :reader method-qualifiers)
379    (specializers :initform () :initarg :specializers
380                  :reader method-specializers)
381    (lambda-list :initform () :initarg :lambda-list :reader method-lambda-list)
382    (%function :initform nil :initarg :function :reader method-function)
383    (%documentation :initform nil :initarg :documentation)))
384
385 (defclass accessor-method (standard-method)
386   ((slot-name :initform nil :initarg :slot-name
387               :reader accessor-method-slot-name)))
388
389 (defclass standard-accessor-method (accessor-method)
390   ((%slot-definition :initform nil :initarg :slot-definition
391                      :reader accessor-method-slot-definition)))
392
393 (defclass standard-reader-method (standard-accessor-method) ())
394 (defclass standard-writer-method (standard-accessor-method) ())
395 ;;; an extension, apparently.
396 (defclass standard-boundp-method (standard-accessor-method) ())
397
398 ;;; for (SLOT-VALUE X 'FOO) / ACCESSOR-SLOT-VALUE optimization, which
399 ;;; can't be STANDARD-READER-METHOD because there is no associated
400 ;;; slot definition.
401 (defclass global-reader-method (accessor-method) ())
402 (defclass global-writer-method (accessor-method) ())
403 (defclass global-boundp-method (accessor-method) ())
404
405 (defclass method-combination (metaobject)
406   ((%documentation :initform nil :initarg :documentation)))
407
408 (defclass standard-method-combination (definition-source-mixin
409                                        method-combination)
410   ((type-name
411     :reader method-combination-type-name
412     :initarg :type-name)
413    (options
414     :reader method-combination-options
415     :initarg :options)))
416
417 (defclass long-method-combination (standard-method-combination)
418   ((function
419     :initarg :function
420     :reader long-method-combination-function)
421    (args-lambda-list
422     :initarg :args-lambda-list
423     :reader long-method-combination-args-lambda-list)))
424
425 (defclass short-method-combination (standard-method-combination)
426   ((operator
427     :reader short-combination-operator
428     :initarg :operator)
429    (identity-with-one-argument
430     :reader short-combination-identity-with-one-argument
431     :initarg :identity-with-one-argument)))
432
433 (defclass slot-definition (metaobject)
434   ((name
435     :initform nil
436     :initarg :name
437     :accessor slot-definition-name)
438    (initform
439     :initform nil
440     :initarg :initform
441     :accessor slot-definition-initform)
442    (initfunction
443     :initform nil
444     :initarg :initfunction
445     :accessor slot-definition-initfunction)
446    (readers
447     :initform nil
448     :initarg :readers
449     :accessor slot-definition-readers)
450    (writers
451     :initform nil
452     :initarg :writers
453     :accessor slot-definition-writers)
454    (initargs
455     :initform nil
456     :initarg :initargs
457     :accessor slot-definition-initargs)
458    (%type :initform t :initarg :type :accessor slot-definition-type)
459    (%type-check-function :initform nil
460                          :initarg type-check-function
461                          :accessor slot-definition-type-check-function)
462    (%documentation
463     :initform nil :initarg :documentation
464     ;; KLUDGE: we need a reader for bootstrapping purposes, in
465     ;; COMPUTE-EFFECTIVE-SLOT-DEFINITION-INITARGS.
466     :reader %slot-definition-documentation)
467    (%class :initform nil :initarg :class :accessor slot-definition-class)))
468
469 (defclass standard-slot-definition (slot-definition)
470   ((allocation
471     :initform :instance
472     :initarg :allocation
473     :accessor slot-definition-allocation)
474    (allocation-class
475     :initform nil
476     :initarg :allocation-class
477     :accessor slot-definition-allocation-class)))
478
479 (defclass condition-slot-definition (slot-definition)
480   ((allocation
481     :initform :instance
482     :initarg :allocation
483     :accessor slot-definition-allocation)
484    (allocation-class
485     :initform nil
486     :initarg :allocation-class
487     :accessor slot-definition-allocation-class)))
488
489 (defclass structure-slot-definition (slot-definition)
490   ((defstruct-accessor-symbol
491      :initform nil
492      :initarg :defstruct-accessor-symbol
493      :accessor slot-definition-defstruct-accessor-symbol)
494    (internal-reader-function
495      :initform nil
496      :initarg :internal-reader-function
497      :accessor slot-definition-internal-reader-function)
498    (internal-writer-function
499      :initform nil
500      :initarg :internal-writer-function
501      :accessor slot-definition-internal-writer-function)))
502
503 (defclass direct-slot-definition (slot-definition)
504   ())
505
506 (defclass effective-slot-definition (slot-definition)
507   ((reader-function ; (lambda (object) ...)
508     :accessor slot-definition-reader-function)
509    (writer-function ; (lambda (new-value object) ...)
510     :accessor slot-definition-writer-function)
511    (boundp-function ; (lambda (object) ...)
512     :accessor slot-definition-boundp-function)
513    (accessor-flags
514     :initform 0)))
515
516 (defclass standard-direct-slot-definition (standard-slot-definition
517                                            direct-slot-definition)
518   ())
519
520 (defclass standard-effective-slot-definition (standard-slot-definition
521                                               effective-slot-definition)
522   ((location ; nil, a fixnum, a cons: (slot-name . value)
523     :initform nil
524     :accessor slot-definition-location)))
525
526 (defclass condition-direct-slot-definition (condition-slot-definition
527                                             direct-slot-definition)
528   ())
529
530 (defclass condition-effective-slot-definition (condition-slot-definition
531                                                effective-slot-definition)
532   ())
533
534 (defclass structure-direct-slot-definition (structure-slot-definition
535                                             direct-slot-definition)
536   ())
537
538 (defclass structure-effective-slot-definition (structure-slot-definition
539                                                effective-slot-definition)
540   ())
541
542 (defclass specializer (metaobject)
543   ;; KLUDGE: in sbcl-0.9.10.2 this was renamed from TYPE, which was an
544   ;; external symbol of the CL package and hence potentially collides
545   ;; with user code.  Renaming this to %TYPE, however, is the coward's
546   ;; way out, because the objects that PCL puts in this slot aren't
547   ;; (quite) types: they are closer to kinds of specializer.  However,
548   ;; the wholesale renaming and disentangling of specializers didn't
549   ;; appeal.  (See also message <sqd5hrclb2.fsf@cam.ac.uk> and
550   ;; responses in comp.lang.lisp).  -- CSR, 2006-02-27
551   ((%type :initform nil :reader specializer-type)))
552
553 (defclass specializer-with-object (specializer) ())
554
555 (defclass exact-class-specializer (specializer) ())
556
557 (defclass class-eq-specializer (exact-class-specializer
558                                 specializer-with-object)
559   ((object :initarg :class
560            :reader specializer-class
561            :reader specializer-object)))
562
563 (defclass class-prototype-specializer (specializer-with-object)
564   ((object :initarg :class
565            :reader specializer-class
566            :reader specializer-object)))
567
568 (defclass eql-specializer (exact-class-specializer specializer-with-object)
569   ((object :initarg :object :reader specializer-object
570            :reader eql-specializer-object)))
571
572 (defvar *eql-specializer-table* (make-hash-table :test 'eql))
573
574 (defun intern-eql-specializer (object)
575   (or (gethash object *eql-specializer-table*)
576       (setf (gethash object *eql-specializer-table*)
577             (make-instance 'eql-specializer :object object))))
578
579 (defclass class (dependent-update-mixin
580                  definition-source-mixin
581                  specializer)
582   ((name
583     :initform nil
584     :initarg :name
585     :reader class-name)
586    (class-eq-specializer
587     :initform nil
588     :reader class-eq-specializer)
589    (direct-superclasses
590     :initform ()
591     :reader class-direct-superclasses)
592    ;; Note: The (CLASS-)DIRECT-SUBCLASSES for STRUCTURE-CLASSes and
593    ;; CONDITION-CLASSes are lazily computed whenever the subclass info
594    ;; becomes available, i.e. when the PCL class is created.
595    (direct-subclasses
596     :initform ()
597     :reader class-direct-subclasses)
598    (direct-methods
599     :initform (cons nil nil))
600    (%documentation
601     :initform nil
602     :initarg :documentation)
603    ;; True if the class definition was compiled with a (SAFETY 3)
604    ;; optimization policy.
605    (safe-p
606     :initform nil
607     :initarg safe-p
608     :accessor safe-p)
609    (finalized-p
610     :initform nil
611     :reader class-finalized-p)))
612
613 (def!method make-load-form ((class class) &optional env)
614   ;; FIXME: should we not instead pass ENV to FIND-CLASS?  Probably
615   ;; doesn't matter while all our environments are the same...
616   (declare (ignore env))
617   (let ((name (class-name class)))
618     (unless (and name (eq (find-class name nil) class))
619       (error "~@<Can't use anonymous or undefined class as constant: ~S~:@>"
620              class))
621     `(find-class ',name)))
622
623 ;;; The class PCL-CLASS is an implementation-specific common
624 ;;; superclass of all specified subclasses of the class CLASS.
625 (defclass pcl-class (class)
626   ((%class-precedence-list
627     :reader class-precedence-list)
628    ;; KLUDGE: see note in CPL-OR-NIL
629    (cpl-available-p
630     :reader cpl-available-p
631     :initform nil)
632    (can-precede-list
633     :initform ()
634     :reader class-can-precede-list)
635    (incompatible-superclass-list
636     :initform ()
637     :accessor class-incompatible-superclass-list)
638    (wrapper
639     :initform nil
640     :reader class-wrapper)
641    (prototype
642     :initform nil
643     :reader class-prototype)))
644
645 (defclass slot-class (pcl-class)
646   ((direct-slots
647     :initform ()
648     :accessor class-direct-slots)
649    (slots
650     :initform ()
651     :accessor class-slots)))
652
653 ;;; The class STD-CLASS is an implementation-specific common
654 ;;; superclass of the classes STANDARD-CLASS and
655 ;;; FUNCALLABLE-STANDARD-CLASS.
656 (defclass std-class (slot-class)
657   ())
658
659 (defclass standard-class (std-class)
660   ())
661
662 (defclass funcallable-standard-class (std-class)
663   ())
664
665 (defclass forward-referenced-class (pcl-class) ())
666
667 (defclass built-in-class (pcl-class) ())
668
669 (defclass condition-class (slot-class) ())
670
671 (defclass structure-class (slot-class)
672   ((defstruct-form
673      :initform ()
674      :accessor class-defstruct-form)
675    (defstruct-constructor
676      :initform nil
677      :accessor class-defstruct-constructor)
678    (from-defclass-p
679     :initform nil
680     :initarg :from-defclass-p)))
681
682 (defclass definition-source-mixin (standard-object)
683   ((source
684     :initform nil
685     :reader definition-source
686     :initarg :definition-source)))
687
688 (defclass plist-mixin (standard-object)
689   ((plist :initform () :accessor object-plist :initarg plist)))
690
691 (defclass dependent-update-mixin (plist-mixin) ())
692
693 (defparameter *early-class-predicates*
694   '((specializer specializerp)
695     (exact-class-specializer exact-class-specializer-p)
696     (class-eq-specializer class-eq-specializer-p)
697     (eql-specializer eql-specializer-p)
698     (class classp)
699     (slot-class slot-class-p)
700     (std-class std-class-p)
701     (standard-class standard-class-p)
702     (funcallable-standard-class funcallable-standard-class-p)
703     (condition-class condition-class-p)
704     (structure-class structure-class-p)
705     (forward-referenced-class forward-referenced-class-p)
706     (method method-p)
707     (standard-method standard-method-p)
708     (accessor-method accessor-method-p)
709     (standard-accessor-method standard-accessor-method-p)
710     (standard-reader-method standard-reader-method-p)
711     (standard-writer-method standard-writer-method-p)
712     (standard-boundp-method standard-boundp-method-p)
713     (global-reader-method global-reader-method-p)
714     (global-writer-method global-writer-method-p)
715     (global-boundp-method global-boundp-method-p)
716     (generic-function generic-function-p)
717     (standard-generic-function standard-generic-function-p)
718     (method-combination method-combination-p)
719     (long-method-combination long-method-combination-p)
720     (short-method-combination short-method-combination-p)))