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