1.0.21.1: address TYPE-WARNING in CLOS allocator for funcallable structures
[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) 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 (defvar *standard-method-combination*)
199 \f
200 (defun plist-value (object name)
201   (getf (object-plist object) name))
202
203 (defun (setf plist-value) (new-value object name)
204   (if new-value
205       (setf (getf (object-plist object) name) new-value)
206       (progn
207         (remf (object-plist object) name)
208         nil)))
209 \f
210 ;;;; built-in classes
211
212 ;;; Grovel over SB-KERNEL::*BUILT-IN-CLASSES* in order to set
213 ;;; SB-PCL:*BUILT-IN-CLASSES*.
214 (/show "about to set up SB-PCL::*BUILT-IN-CLASSES*")
215 (defvar *built-in-classes*
216   (labels ((direct-supers (class)
217              (/noshow "entering DIRECT-SUPERS" (classoid-name class))
218              (if (typep class 'built-in-classoid)
219                  (built-in-classoid-direct-superclasses class)
220                  (let ((inherits (layout-inherits
221                                   (classoid-layout class))))
222                    (/noshow inherits)
223                    (list (svref inherits (1- (length inherits)))))))
224            (direct-subs (class)
225              (/noshow "entering DIRECT-SUBS" (classoid-name class))
226              (collect ((res))
227                (let ((subs (classoid-subclasses class)))
228                  (/noshow subs)
229                  (when subs
230                    (dohash ((sub v) subs)
231                      (declare (ignore v))
232                      (/noshow sub)
233                      (when (member class (direct-supers sub) :test #'eq)
234                        (res sub)))))
235                (res))))
236     (mapcar (lambda (kernel-bic-entry)
237               (/noshow "setting up" kernel-bic-entry)
238               (let* ((name (car kernel-bic-entry))
239                      (class (find-classoid name))
240                      (prototype-form
241                       (getf (cdr kernel-bic-entry) :prototype-form)))
242                 (/noshow name class)
243                 `(,name
244                   ,(mapcar #'classoid-name (direct-supers class))
245                   ,(mapcar #'classoid-name (direct-subs class))
246                   ,(map 'list
247                         (lambda (x)
248                           (classoid-name
249                            (layout-classoid x)))
250                         (reverse
251                          (layout-inherits
252                           (classoid-layout class))))
253                   ,(if prototype-form
254                        (eval prototype-form)
255                        ;; This is the default prototype value which
256                        ;; was used, without explanation, by the CMU CL
257                        ;; code we're derived from. Evidently it's safe
258                        ;; in all relevant cases.
259                        42))))
260             (remove-if (lambda (kernel-bic-entry)
261                          (member (first kernel-bic-entry)
262                                  ;; I'm not sure why these are removed from
263                                  ;; the list, but that's what the original
264                                  ;; CMU CL code did. -- WHN 20000715
265                                  '(t function stream
266                                      file-stream string-stream)))
267                        sb-kernel::*built-in-classes*))))
268 (/noshow "done setting up SB-PCL::*BUILT-IN-CLASSES*")
269 \f
270 ;;;; the classes that define the kernel of the metabraid
271
272 (defclass t () ()
273   (:metaclass built-in-class))
274
275 (defclass function (t) ()
276   (:metaclass built-in-class))
277
278 (defclass stream (t) ()
279   (:metaclass built-in-class))
280
281 (defclass file-stream (stream) ()
282   (:metaclass built-in-class))
283
284 (defclass string-stream (stream) ()
285   (:metaclass built-in-class))
286
287 (defclass slot-object (t) ()
288   (:metaclass slot-class))
289
290 (defclass condition (slot-object) ()
291   (:metaclass condition-class))
292
293 (defclass structure-object (slot-object) ()
294   (:metaclass structure-class))
295
296 (defstruct (dead-beef-structure-object
297             (:constructor |STRUCTURE-OBJECT class constructor|)
298             (:copier nil)))
299
300 (defclass standard-object (slot-object) ())
301
302 (defclass funcallable-standard-object (function standard-object)
303   ()
304   (:metaclass funcallable-standard-class))
305
306 (defclass metaobject (standard-object) ())
307
308 (defclass generic-function (dependent-update-mixin
309                             definition-source-mixin
310                             metaobject
311                             funcallable-standard-object)
312   ((%documentation
313     :initform nil
314     :initarg :documentation)
315    ;; We need to make a distinction between the methods initially set
316    ;; up by :METHOD options to DEFGENERIC and the ones set up later by
317    ;; DEFMETHOD, because ANSI specifies that executing DEFGENERIC on
318    ;; an already-DEFGENERICed function clears the methods set by the
319    ;; previous DEFGENERIC, but not methods set by DEFMETHOD. (Making
320    ;; this distinction seems a little kludgy, but it has the positive
321    ;; effect of making it so that loading a file a.lisp containing
322    ;; DEFGENERIC, then loading a second file b.lisp containing
323    ;; DEFMETHOD, then modifying and reloading a.lisp and/or b.lisp
324    ;; tends to leave the generic function in a state consistent with
325    ;; the most-recently-loaded state of a.lisp and b.lisp.)
326    (initial-methods
327     :initform ()
328     :accessor generic-function-initial-methods))
329   (:metaclass funcallable-standard-class))
330
331 (defclass standard-generic-function (generic-function)
332   ((name
333     :initform nil
334     :initarg :name
335     :reader generic-function-name)
336    (methods
337     :initform ()
338     :accessor generic-function-methods
339     :type list)
340    (method-class
341     :initarg :method-class
342     :accessor generic-function-method-class)
343    (%method-combination
344     :initarg :method-combination
345     :accessor generic-function-method-combination)
346    (declarations
347     ;; KLUDGE: AMOP specifies :DECLARATIONS, while ANSI specifies
348     ;; :DECLARE.  Allow either (but FIXME: maybe a note or a warning
349     ;; might be appropriate).
350     :initarg :declarations
351     :initarg :declare
352     :initform ()
353     :accessor generic-function-declarations)
354    (arg-info
355     :initform (make-arg-info)
356     :reader gf-arg-info)
357    (dfun-state
358     :initform ()
359     :accessor gf-dfun-state)
360    ;; Used to make DFUN-STATE & FIN-FUNCTION updates atomic.
361    (%lock
362     :initform (sb-thread::make-spinlock :name "GF lock")
363     :reader gf-lock)
364    ;; Set to true by ADD-METHOD, REMOVE-METHOD; to false by
365    ;; MAYBE-UPDATE-INFO-FOR-GF.
366    (info-needs-update
367     :initform nil
368     :accessor gf-info-needs-update))
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 :initform nil :accessor method-generic-function)
377    (qualifiers :initform () :initarg :qualifiers :reader method-qualifiers)
378    (specializers :initform () :initarg :specializers
379                  :reader method-specializers)
380    (lambda-list :initform () :initarg :lambda-list :reader method-lambda-list)
381    (%function :initform nil :initarg :function :reader method-function)
382    (%documentation :initform nil :initarg :documentation)))
383
384 (defclass accessor-method (standard-method)
385   ((slot-name :initform nil :initarg :slot-name
386               :reader accessor-method-slot-name)))
387
388 (defclass standard-accessor-method (accessor-method)
389   ((%slot-definition :initform nil :initarg :slot-definition
390                      :reader accessor-method-slot-definition)))
391
392 (defclass standard-reader-method (standard-accessor-method) ())
393 (defclass standard-writer-method (standard-accessor-method) ())
394 ;;; an extension, apparently.
395 (defclass standard-boundp-method (standard-accessor-method) ())
396
397 ;;; for (SLOT-VALUE X 'FOO) / ACCESSOR-SLOT-VALUE optimization, which
398 ;;; can't be STANDARD-READER-METHOD because there is no associated
399 ;;; slot definition.
400 (defclass global-reader-method (accessor-method) ())
401 (defclass global-writer-method (accessor-method) ())
402 (defclass global-boundp-method (accessor-method) ())
403
404 (defclass method-combination (metaobject)
405   ((%documentation :initform nil :initarg :documentation)))
406
407 (defclass standard-method-combination (definition-source-mixin
408                                        method-combination)
409   ((type-name
410     :reader method-combination-type-name
411     :initarg :type-name)
412    (options
413     :reader method-combination-options
414     :initarg :options)))
415
416 (defclass long-method-combination (standard-method-combination)
417   ((function
418     :initarg :function
419     :reader long-method-combination-function)
420    (args-lambda-list
421     :initarg :args-lambda-list
422     :reader long-method-combination-args-lambda-list)))
423
424 (defclass short-method-combination (standard-method-combination)
425   ((operator
426     :reader short-combination-operator
427     :initarg :operator)
428    (identity-with-one-argument
429     :reader short-combination-identity-with-one-argument
430     :initarg :identity-with-one-argument)))
431
432 (defclass slot-definition (metaobject)
433   ((name
434     :initform nil
435     :initarg :name
436     :accessor slot-definition-name)
437    (initform
438     :initform nil
439     :initarg :initform
440     :accessor slot-definition-initform)
441    (initfunction
442     :initform nil
443     :initarg :initfunction
444     :accessor slot-definition-initfunction)
445    (readers
446     :initform nil
447     :initarg :readers
448     :accessor slot-definition-readers)
449    (writers
450     :initform nil
451     :initarg :writers
452     :accessor slot-definition-writers)
453    (initargs
454     :initform nil
455     :initarg :initargs
456     :accessor slot-definition-initargs)
457    (%type :initform t :initarg :type :accessor slot-definition-type)
458    (%type-check-function :initform nil
459                          :initarg type-check-function
460                          :accessor slot-definition-type-check-function)
461    (%documentation
462     :initform nil :initarg :documentation
463     ;; KLUDGE: we need a reader for bootstrapping purposes, in
464     ;; COMPUTE-EFFECTIVE-SLOT-DEFINITION-INITARGS.
465     :reader %slot-definition-documentation)
466    (%class :initform nil :initarg :class :accessor slot-definition-class)))
467
468 (defclass standard-slot-definition (slot-definition)
469   ((allocation
470     :initform :instance
471     :initarg :allocation
472     :accessor slot-definition-allocation)
473    (allocation-class
474     :initform nil
475     :initarg :allocation-class
476     :accessor slot-definition-allocation-class)))
477
478 (defclass condition-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 structure-slot-definition (slot-definition)
489   ((defstruct-accessor-symbol
490      :initform nil
491      :initarg :defstruct-accessor-symbol
492      :accessor slot-definition-defstruct-accessor-symbol)
493    (internal-reader-function
494      :initform nil
495      :initarg :internal-reader-function
496      :accessor slot-definition-internal-reader-function)
497    (internal-writer-function
498      :initform nil
499      :initarg :internal-writer-function
500      :accessor slot-definition-internal-writer-function)))
501
502 (defclass direct-slot-definition (slot-definition)
503   ())
504
505 (defclass effective-slot-definition (slot-definition)
506   ((reader-function ; (lambda (object) ...)
507     :accessor slot-definition-reader-function)
508    (writer-function ; (lambda (new-value object) ...)
509     :accessor slot-definition-writer-function)
510    (boundp-function ; (lambda (object) ...)
511     :accessor slot-definition-boundp-function)
512    (accessor-flags
513     :initform 0)))
514
515 (defclass standard-direct-slot-definition (standard-slot-definition
516                                            direct-slot-definition)
517   ())
518
519 (defclass standard-effective-slot-definition (standard-slot-definition
520                                               effective-slot-definition)
521   ((location ; nil, a fixnum, a cons: (slot-name . value)
522     :initform nil
523     :accessor slot-definition-location)))
524
525 (defclass condition-direct-slot-definition (condition-slot-definition
526                                             direct-slot-definition)
527   ())
528
529 (defclass condition-effective-slot-definition (condition-slot-definition
530                                                effective-slot-definition)
531   ())
532
533 (defclass structure-direct-slot-definition (structure-slot-definition
534                                             direct-slot-definition)
535   ())
536
537 (defclass structure-effective-slot-definition (structure-slot-definition
538                                                effective-slot-definition)
539   ())
540
541 (defclass specializer (metaobject)
542   ;; KLUDGE: in sbcl-0.9.10.2 this was renamed from TYPE, which was an
543   ;; external symbol of the CL package and hence potentially collides
544   ;; with user code.  Renaming this to %TYPE, however, is the coward's
545   ;; way out, because the objects that PCL puts in this slot aren't
546   ;; (quite) types: they are closer to kinds of specializer.  However,
547   ;; the wholesale renaming and disentangling of specializers didn't
548   ;; appeal.  (See also message <sqd5hrclb2.fsf@cam.ac.uk> and
549   ;; responses in comp.lang.lisp).  -- CSR, 2006-02-27
550   ((%type :initform nil :reader specializer-type)))
551
552 ;;; STANDARD in this name doesn't mean "blessed by a standard" but
553 ;;; "comes as standard with PCL"; that is, it includes CLASS-EQ
554 ;;; and vestiges of PROTOTYPE specializers
555 (defclass standard-specializer (specializer) ())
556
557 (defclass specializer-with-object (specializer) ())
558
559 (defclass exact-class-specializer (specializer) ())
560
561 (defclass class-eq-specializer (standard-specializer
562                                 exact-class-specializer
563                                 specializer-with-object)
564   ((object :initarg :class
565            :reader specializer-class
566            :reader specializer-object)))
567
568 (defclass class-prototype-specializer (standard-specializer specializer-with-object)
569   ((object :initarg :class
570            :reader specializer-class
571            :reader specializer-object)))
572
573 (defclass eql-specializer (standard-specializer exact-class-specializer specializer-with-object)
574   ((object :initarg :object :reader specializer-object
575            :reader eql-specializer-object)))
576
577 (defvar *eql-specializer-table* (make-hash-table :test 'eql))
578
579 (defvar *eql-specializer-table-lock*
580   (sb-thread::make-spinlock :name "EQL-specializer table lock"))
581
582 (defun intern-eql-specializer (object)
583   ;; Need to lock, so that two threads don't get non-EQ specializers
584   ;; for an EQL object.
585   (sb-thread::with-spinlock (*eql-specializer-table-lock*)
586     (or (gethash object *eql-specializer-table*)
587         (setf (gethash object *eql-specializer-table*)
588               (make-instance 'eql-specializer :object object)))))
589
590 (defclass class (dependent-update-mixin
591                  definition-source-mixin
592                  standard-specializer)
593   ((name
594     :initform nil
595     :initarg :name
596     :reader class-name)
597    (class-eq-specializer
598     :initform nil
599     :reader class-eq-specializer)
600    (direct-superclasses
601     :initform ()
602     :reader class-direct-superclasses)
603    ;; Note: The (CLASS-)DIRECT-SUBCLASSES for STRUCTURE-CLASSes and
604    ;; CONDITION-CLASSes are lazily computed whenever the subclass info
605    ;; becomes available, i.e. when the PCL class is created.
606    (direct-subclasses
607     :initform ()
608     :reader class-direct-subclasses)
609    (direct-methods
610     :initform (cons nil nil))
611    (%documentation
612     :initform nil
613     :initarg :documentation)
614    ;; True if the class definition was compiled with a (SAFETY 3)
615    ;; optimization policy.
616    (safe-p
617     :initform nil
618     :initarg safe-p
619     :accessor safe-p)
620    (finalized-p
621     :initform nil
622     :reader class-finalized-p)))
623
624 (def!method make-load-form ((class class) &optional env)
625   ;; FIXME: should we not instead pass ENV to FIND-CLASS?  Probably
626   ;; doesn't matter while all our environments are the same...
627   (declare (ignore env))
628   (let ((name (class-name class)))
629     (unless (and name (eq (find-class name nil) class))
630       (error "~@<Can't use anonymous or undefined class as constant: ~S~:@>"
631              class))
632     `(find-class ',name)))
633
634 ;;; The class PCL-CLASS is an implementation-specific common
635 ;;; superclass of all specified subclasses of the class CLASS.
636 (defclass pcl-class (class)
637   ((%class-precedence-list
638     :reader class-precedence-list)
639    ;; KLUDGE: see note in CPL-OR-NIL
640    (cpl-available-p
641     :reader cpl-available-p
642     :initform nil)
643    (can-precede-list
644     :initform ()
645     :reader class-can-precede-list)
646    (incompatible-superclass-list
647     :initform ()
648     :accessor class-incompatible-superclass-list)
649    (wrapper
650     :initform nil
651     :reader class-wrapper)
652    (prototype
653     :initform nil
654     :reader class-prototype)))
655
656 (defclass slot-class (pcl-class)
657   ((direct-slots
658     :initform ()
659     :reader class-direct-slots)
660    (slots
661     :initform ()
662     :reader class-slots)))
663
664 ;;; The class STD-CLASS is an implementation-specific common
665 ;;; superclass of the classes STANDARD-CLASS and
666 ;;; FUNCALLABLE-STANDARD-CLASS.
667 (defclass std-class (slot-class)
668   ())
669
670 (defclass standard-class (std-class)
671   ())
672
673 (defclass funcallable-standard-class (std-class)
674   ())
675
676 (defclass forward-referenced-class (pcl-class) ())
677
678 (defclass built-in-class (pcl-class) ())
679
680 (defclass condition-class (slot-class) ())
681
682 (defclass structure-class (slot-class)
683   ((defstruct-form :initform () :accessor class-defstruct-form)
684    (defstruct-constructor :initform nil :accessor class-defstruct-constructor)
685    (from-defclass-p :initform nil :initarg :from-defclass-p)))
686
687 (defclass definition-source-mixin (standard-object)
688   ((source
689     :initform nil
690     :reader definition-source
691     :initarg :definition-source)))
692
693 (defclass plist-mixin (standard-object)
694   ((plist :initform () :accessor object-plist :initarg plist)))
695
696 (defclass dependent-update-mixin (plist-mixin) ())
697
698 (defparameter *early-class-predicates*
699   '((specializer specializerp)
700     (standard-specializer standard-specializer-p)
701     (exact-class-specializer exact-class-specializer-p)
702     (class-eq-specializer class-eq-specializer-p)
703     (eql-specializer eql-specializer-p)
704     (class classp)
705     (slot-class slot-class-p)
706     (std-class std-class-p)
707     (standard-class standard-class-p)
708     (funcallable-standard-class funcallable-standard-class-p)
709     (condition-class condition-class-p)
710     (structure-class structure-class-p)
711     (forward-referenced-class forward-referenced-class-p)
712     (method method-p)
713     (standard-method standard-method-p)
714     (accessor-method accessor-method-p)
715     (standard-accessor-method standard-accessor-method-p)
716     (standard-reader-method standard-reader-method-p)
717     (standard-writer-method standard-writer-method-p)
718     (standard-boundp-method standard-boundp-method-p)
719     (global-reader-method global-reader-method-p)
720     (global-writer-method global-writer-method-p)
721     (global-boundp-method global-boundp-method-p)
722     (generic-function generic-function-p)
723     (standard-generic-function standard-generic-function-p)
724     (method-combination method-combination-p)
725     (long-method-combination long-method-combination-p)
726     (short-method-combination short-method-combination-p)))