1 ;;;; bootstrapping the meta-braid
3 ;;;; The code in this file takes the early definitions that have been
4 ;;;; saved up and actually builds those class objects. This work is
5 ;;;; largely driven off of those class definitions, but the fact that
6 ;;;; STANDARD-CLASS is the class of all metaclasses in the braid is
7 ;;;; built into this code pretty deeply.
9 ;;;; This software is part of the SBCL system. See the README file for
10 ;;;; more information.
12 ;;;; This software is derived from software originally released by Xerox
13 ;;;; Corporation. Copyright and release statements follow. Later modifications
14 ;;;; to the software are in the public domain and are provided with
15 ;;;; absolutely no warranty. See the COPYING and CREDITS files for more
18 ;;;; copyright information from original PCL sources:
20 ;;;; Copyright (c) 1985, 1986, 1987, 1988, 1989, 1990 Xerox Corporation.
21 ;;;; All rights reserved.
23 ;;;; Use and copying of this software and preparation of derivative works based
24 ;;;; upon this software are permitted. Any distribution of this software or
25 ;;;; derivative works must comply with all applicable United States export
28 ;;;; This software is made available AS IS, and Xerox Corporation makes no
29 ;;;; warranty about the software, its performance or its conformity to any
34 (defun allocate-standard-instance (wrapper
35 &optional
(slots-init nil slots-init-p
))
36 (let ((instance (%make-standard-instance nil
(get-instance-hash-code)))
37 (no-of-slots (wrapper-no-of-instance-slots wrapper
)))
38 (setf (std-instance-wrapper instance
) wrapper
)
39 (setf (std-instance-slots instance
)
41 ;; Inline the slots vector allocation and initialization.
42 (let ((slots (make-array no-of-slots
:initial-element
0)))
43 (do ((rem-slots slots-init
(rest rem-slots
))
45 ((>= i no-of-slots
)) ;endp rem-slots))
46 (declare (list rem-slots
)
48 (setf (aref slots i
) (first rem-slots
)))
51 (make-array no-of-slots
52 :initial-element
+slot-unbound
+))))
55 (defmacro allocate-standard-funcallable-instance-slots
56 (wrapper &optional slots-init-p slots-init
)
57 `(let ((no-of-slots (wrapper-no-of-instance-slots ,wrapper
)))
60 (make-array no-of-slots
:initial-contents
,slots-init
)
61 (make-array no-of-slots
:initial-element
+slot-unbound
+))
62 `(make-array no-of-slots
:initial-element
+slot-unbound
+))))
64 (define-condition unset-funcallable-instance-function
65 (reference-condition simple-error
)
68 :references
(list '(:amop
:generic-function allocate-instance
)
69 '(:amop
:function set-funcallable-instance-function
))))
71 (defun allocate-standard-funcallable-instance
72 (wrapper &optional
(slots-init nil slots-init-p
))
73 (let ((fin (%make-standard-funcallable-instance
74 nil nil
(get-instance-hash-code))))
75 (set-funcallable-instance-function
77 #'(lambda (&rest args
)
78 (declare (ignore args
))
79 (error 'unset-funcallable-instance-function
80 :format-control
"~@<The function of funcallable instance ~
81 ~S has not been set.~@:>"
82 :format-arguments
(list fin
))))
83 (setf (fsc-instance-wrapper fin
) wrapper
84 (fsc-instance-slots fin
)
85 (allocate-standard-funcallable-instance-slots
86 wrapper slots-init-p slots-init
))
89 (defun allocate-structure-instance (wrapper &optional
90 (slots-init nil slots-init-p
))
91 (let* ((class (wrapper-class wrapper
))
92 (constructor (class-defstruct-constructor class
)))
94 (let ((instance (funcall constructor
))
95 (slots (class-slots class
)))
98 (setf (slot-value-using-class class instance slot
)
101 (error "can't allocate an instance of class ~S" (class-name class
)))))
103 ;;;; BOOTSTRAP-META-BRAID
105 ;;;; This function builds the base metabraid from the early class definitions.
107 (defmacro !initial-classes-and-wrappers
(&rest classes
)
109 ,@(mapcar (lambda (class)
110 (let ((wr (format-symbol *pcl-package
* "~A-WRAPPER" class
)))
111 `(setf ,wr
,(if (eq class
'standard-generic-function
)
114 (early-class-size ',class
)
116 ,class
(allocate-standard-instance
117 ,(if (eq class
'standard-generic-function
)
118 'funcallable-standard-class-wrapper
119 'standard-class-wrapper
))
120 (wrapper-class ,wr
) ,class
121 (find-class ',class
) ,class
)))
124 (defun !bootstrap-meta-braid
()
125 (let* ((*create-classes-from-internal-structure-definitions-p
* nil
)
126 standard-class-wrapper standard-class
127 funcallable-standard-class-wrapper funcallable-standard-class
128 slot-class-wrapper slot-class
129 built-in-class-wrapper built-in-class
130 structure-class-wrapper structure-class
131 condition-class-wrapper condition-class
132 standard-direct-slot-definition-wrapper
133 standard-direct-slot-definition
134 standard-effective-slot-definition-wrapper
135 standard-effective-slot-definition
136 class-eq-specializer-wrapper class-eq-specializer
137 standard-generic-function-wrapper standard-generic-function
)
138 (!initial-classes-and-wrappers
139 standard-class funcallable-standard-class
140 slot-class built-in-class structure-class condition-class
141 standard-direct-slot-definition standard-effective-slot-definition
142 class-eq-specializer standard-generic-function
)
143 ;; First, make a class metaobject for each of the early classes. For
144 ;; each metaobject we also set its wrapper. Except for the class T,
145 ;; the wrapper is always that of STANDARD-CLASS.
146 (dolist (definition *early-class-definitions
*)
147 (let* ((name (ecd-class-name definition
))
148 (meta (ecd-metaclass definition
))
150 (slot-class slot-class-wrapper
)
151 (standard-class standard-class-wrapper
)
152 (funcallable-standard-class
153 funcallable-standard-class-wrapper
)
154 (built-in-class built-in-class-wrapper
)
155 (structure-class structure-class-wrapper
)
156 (condition-class condition-class-wrapper
)))
157 (class (or (find-class name nil
)
158 (allocate-standard-instance wrapper
))))
159 (setf (find-class name
) class
)))
160 (dolist (definition *early-class-definitions
*)
161 (let ((name (ecd-class-name definition
))
162 (meta (ecd-metaclass definition
))
163 (source (ecd-source-location definition
))
164 (direct-supers (ecd-superclass-names definition
))
165 (direct-slots (ecd-canonical-slots definition
))
166 (other-initargs (ecd-other-initargs definition
)))
167 (let ((direct-default-initargs
168 (getf other-initargs
:direct-default-initargs
)))
169 (multiple-value-bind (slots cpl default-initargs direct-subclasses
)
170 (early-collect-inheritance name
)
171 (let* ((class (find-class name
))
172 (wrapper (cond ((eq class slot-class
)
174 ((eq class standard-class
)
175 standard-class-wrapper
)
176 ((eq class funcallable-standard-class
)
177 funcallable-standard-class-wrapper
)
178 ((eq class standard-direct-slot-definition
)
179 standard-direct-slot-definition-wrapper
)
181 standard-effective-slot-definition
)
182 standard-effective-slot-definition-wrapper
)
183 ((eq class built-in-class
)
184 built-in-class-wrapper
)
185 ((eq class structure-class
)
186 structure-class-wrapper
)
187 ((eq class condition-class
)
188 condition-class-wrapper
)
189 ((eq class class-eq-specializer
)
190 class-eq-specializer-wrapper
)
191 ((eq class standard-generic-function
)
192 standard-generic-function-wrapper
)
194 (boot-make-wrapper (length slots
) name
))))
196 (when (eq name t
) (setq *the-wrapper-of-t
* wrapper
))
197 (set (make-class-symbol name
) class
)
199 (unless (eq (getf slot
:allocation
:instance
) :instance
)
200 (error "Slot allocation ~S is not supported in bootstrap."
201 (getf slot
:allocation
))))
203 (when (typep wrapper
'wrapper
)
204 (setf (wrapper-instance-slots-layout wrapper
)
205 (mapcar #'canonical-slot-name slots
))
206 (setf (wrapper-class-slots wrapper
)
209 (setq proto
(if (eq meta
'funcallable-standard-class
)
210 (allocate-standard-funcallable-instance wrapper
)
211 (allocate-standard-instance wrapper
)))
214 (!bootstrap-make-slot-definitions
215 name class direct-slots
216 standard-direct-slot-definition-wrapper nil
))
218 (!bootstrap-make-slot-definitions
220 standard-effective-slot-definition-wrapper t
))
223 ((standard-class funcallable-standard-class
)
224 (!bootstrap-initialize-class
226 class name class-eq-specializer-wrapper source
227 direct-supers direct-subclasses cpl wrapper proto
228 direct-slots slots direct-default-initargs default-initargs
))
229 (built-in-class ; *the-class-t*
230 (!bootstrap-initialize-class
232 class name class-eq-specializer-wrapper source
233 direct-supers direct-subclasses cpl wrapper proto
))
234 (slot-class ; *the-class-slot-object*
235 (!bootstrap-initialize-class
237 class name class-eq-specializer-wrapper source
238 direct-supers direct-subclasses cpl wrapper proto
))
239 (structure-class ; *the-class-structure-object*
240 (!bootstrap-initialize-class
242 class name class-eq-specializer-wrapper source
243 direct-supers direct-subclasses cpl wrapper
))
245 (!bootstrap-initialize-class
247 class name class-eq-specializer-wrapper source
248 direct-supers direct-subclasses cpl wrapper
))))))))
250 (let* ((smc-class (find-class 'standard-method-combination
))
251 (smc-wrapper (!bootstrap-get-slot
'standard-class
254 (smc (allocate-standard-instance smc-wrapper
)))
255 (flet ((set-slot (name value
)
256 (!bootstrap-set-slot
'standard-method-combination
260 (set-slot 'source nil
)
261 (set-slot 'type-name
'standard
)
262 (set-slot '%documentation
"The standard method combination.")
263 (set-slot 'options
()))
264 (setq *standard-method-combination
* smc
))))
266 ;;; Initialize a class metaobject.
267 (defun !bootstrap-initialize-class
268 (metaclass-name class name
269 class-eq-wrapper source direct-supers direct-subclasses cpl wrapper
272 direct-slots slots direct-default-initargs default-initargs
)
273 (flet ((classes (names) (mapcar #'find-class names
))
274 (set-slot (slot-name value
)
275 (!bootstrap-set-slot metaclass-name class slot-name value
)))
276 (set-slot 'name name
)
277 (set-slot 'finalized-p t
)
278 (set-slot 'source source
)
279 (set-slot 'safe-p nil
)
280 (set-slot '%type
(if (eq class
(find-class t
))
282 ;; FIXME: Could this just be CLASS instead
283 ;; of `(CLASS ,CLASS)? If not, why not?
284 ;; (See also similar expression in
285 ;; SHARED-INITIALIZE :BEFORE (CLASS).)
287 (set-slot 'class-eq-specializer
288 (let ((spec (allocate-standard-instance class-eq-wrapper
)))
289 (!bootstrap-set-slot
'class-eq-specializer spec
'%type
291 (!bootstrap-set-slot
'class-eq-specializer spec
'object
294 (set-slot '%class-precedence-list
(classes cpl
))
295 (set-slot 'cpl-available-p t
)
296 (set-slot 'can-precede-list
(classes (cdr cpl
)))
297 (set-slot 'incompatible-superclass-list nil
)
298 (set-slot 'direct-superclasses
(classes direct-supers
))
299 (set-slot 'direct-subclasses
(classes direct-subclasses
))
300 (set-slot 'direct-methods
(cons nil nil
))
301 (set-slot 'wrapper wrapper
)
302 (set-slot '%documentation nil
)
304 `(,@(and direct-default-initargs
305 `(direct-default-initargs ,direct-default-initargs
))
306 ,@(and default-initargs
307 `(default-initargs ,default-initargs
))))
308 (when (memq metaclass-name
'(standard-class funcallable-standard-class
309 structure-class condition-class
311 (set-slot 'direct-slots direct-slots
)
312 (set-slot 'slots slots
)
313 (set-slot 'slot-vector
(make-slot-vector slots
)))
315 ;; For all direct superclasses SUPER of CLASS, make sure CLASS is
316 ;; a direct subclass of SUPER. Note that METACLASS-NAME doesn't
317 ;; matter here for the slot DIRECT-SUBCLASSES, since every class
318 ;; inherits the slot from class CLASS.
319 (dolist (super direct-supers
)
320 (let* ((super (find-class super
))
321 (subclasses (!bootstrap-get-slot metaclass-name super
322 'direct-subclasses
)))
323 (cond ((eq +slot-unbound
+ subclasses
)
324 (!bootstrap-set-slot metaclass-name super
'direct-subclasses
326 ((not (memq class subclasses
))
327 (!bootstrap-set-slot metaclass-name super
'direct-subclasses
328 (cons class subclasses
))))))
332 (let ((constructor-sym '|STRUCTURE-OBJECT class constructor|
))
333 (set-slot 'defstruct-form
334 `(defstruct (structure-object (:constructor
337 (set-slot 'defstruct-constructor constructor-sym
)
338 (set-slot 'from-defclass-p t
)
339 (set-slot 'plist nil
)
340 (set-slot 'prototype
(funcall constructor-sym
))))
342 (set-slot 'prototype
(make-condition name
)))
345 (if proto-p proto
(allocate-standard-instance wrapper
)))))
348 (defun !bootstrap-make-slot-definitions
(name class slots wrapper effective-p
)
350 (mapcar (lambda (slot)
352 (!bootstrap-make-slot-definition
353 name class slot wrapper effective-p index
))
356 (defun !bootstrap-make-slot-definition
357 (name class slot wrapper effective-p index
)
358 (let* ((slotd-class-name (if effective-p
359 'standard-effective-slot-definition
360 'standard-direct-slot-definition
))
361 (slotd (allocate-standard-instance wrapper
))
362 (slot-name (getf slot
:name
)))
363 (flet ((get-val (name) (getf slot name
))
365 (!bootstrap-set-slot slotd-class-name slotd name val
)))
366 (set-val 'name slot-name
)
367 (set-val 'initform
(get-val :initform
))
368 (set-val 'initfunction
(get-val :initfunction
))
369 (set-val 'initargs
(get-val :initargs
))
370 (set-val 'readers
(get-val :readers
))
371 (set-val 'writers
(get-val :writers
))
372 (set-val 'allocation
:instance
)
373 (set-val '%type
(or (get-val :type
) t
))
374 (set-val '%type-check-function
(get-val 'type-check-function
))
375 (set-val '%documentation
(or (get-val :documentation
) ""))
376 (set-val '%class class
)
378 (set-val 'location index
)
380 (set-val 'reader-function
(make-optimized-std-reader-method-function
381 fsc-p nil slot-name index
))
382 (set-val 'writer-function
(make-optimized-std-writer-method-function
383 fsc-p nil slot-name index
))
384 (set-val 'boundp-function
(make-optimized-std-boundp-method-function
385 fsc-p nil slot-name index
)))
386 (set-val 'accessor-flags
7))
387 (when (and (eq name
'standard-class
)
388 (eq slot-name
'slots
) effective-p
)
389 (setq *the-eslotd-standard-class-slots
* slotd
))
390 (when (and (eq name
'funcallable-standard-class
)
391 (eq slot-name
'slots
) effective-p
)
392 (setq *the-eslotd-funcallable-standard-class-slots
* slotd
))
395 (defun !bootstrap-accessor-definitions
(early-p)
396 (let ((*early-p
* early-p
))
397 (dolist (definition *early-class-definitions
*)
398 (let ((name (ecd-class-name definition
))
399 (meta (ecd-metaclass definition
)))
400 (unless (eq meta
'built-in-class
)
401 (let ((direct-slots (ecd-canonical-slots definition
)))
402 (dolist (slotd direct-slots
)
403 (let ((slot-name (getf slotd
:name
))
404 (readers (getf slotd
:readers
))
405 (writers (getf slotd
:writers
)))
406 (!bootstrap-accessor-definitions1
413 (defun !bootstrap-accessor-definition
(class-name accessor-name slot-name type
)
414 (multiple-value-bind (accessor-class make-method-function arglist specls doc
)
416 (reader (values 'standard-reader-method
417 #'make-std-reader-method-function
420 "automatically generated reader method"))
421 (writer (values 'standard-writer-method
422 #'make-std-writer-method-function
423 (list 'new-value class-name
)
425 "automatically generated writer method"))
426 (boundp (values 'standard-boundp-method
427 #'make-std-boundp-method-function
430 "automatically generated boundp method")))
431 (let ((gf (ensure-generic-function accessor-name
:lambda-list arglist
)))
432 (if (find specls
(early-gf-methods gf
)
433 :key
#'early-method-specializers
435 (unless (assoc accessor-name
*!generic-function-fixups
*
439 (make-a-method accessor-class
442 (funcall make-method-function
443 class-name slot-name
)
446 :object-class class-name
447 :method-class-function
(constantly (find-class accessor-class
))))))))
449 (defun !bootstrap-accessor-definitions1
(class-name
454 (flet ((do-reader-definition (reader)
455 (!bootstrap-accessor-definition class-name
459 (do-writer-definition (writer)
460 (!bootstrap-accessor-definition class-name
464 (do-boundp-definition (boundp)
465 (!bootstrap-accessor-definition class-name
469 (dolist (reader readers
) (do-reader-definition reader
))
470 (dolist (writer writers
) (do-writer-definition writer
))
471 (dolist (boundp boundps
) (do-boundp-definition boundp
))))
473 ;;; FIXME: find a better name.
474 (defun !bootstrap-class-predicates
(early-p)
475 (let ((*early-p
* early-p
))
476 (dolist (ecp *early-class-predicates
*)
477 (let ((class-name (car ecp
))
478 (predicate-name (cadr ecp
)))
479 (make-class-predicate (find-class class-name
) predicate-name
)))))
481 (defun !bootstrap-built-in-classes
()
483 ;; First make sure that all the supers listed in
484 ;; *BUILT-IN-CLASS-LATTICE* are themselves defined by
485 ;; *BUILT-IN-CLASS-LATTICE*. This is just to check for typos and
486 ;; other sorts of brainos.
487 (dolist (e *built-in-classes
*)
488 (dolist (super (cadr e
))
489 (unless (or (eq super t
)
490 (assq super
*built-in-classes
*))
491 (error "in *BUILT-IN-CLASSES*: ~S has ~S as a super,~%~
492 but ~S is not itself a class in *BUILT-IN-CLASSES*."
493 (car e
) super super
))))
495 ;; In the first pass, we create a skeletal object to be bound to the
497 (let* ((built-in-class (find-class 'built-in-class
))
498 (built-in-class-wrapper (class-wrapper built-in-class
)))
499 (dolist (e *built-in-classes
*)
500 (let ((class (allocate-standard-instance built-in-class-wrapper
)))
501 (setf (find-class (car e
)) class
))))
503 ;; In the second pass, we initialize the class objects.
504 (let ((class-eq-wrapper (class-wrapper (find-class 'class-eq-specializer
))))
505 (dolist (e *built-in-classes
*)
506 (destructuring-bind (name supers subs cpl prototype
) e
507 (let* ((class (find-class name
))
508 (lclass (find-classoid name
))
509 (wrapper (classoid-layout lclass
)))
510 (set (get-built-in-class-symbol name
) class
)
511 (set (get-built-in-wrapper-symbol name
) wrapper
)
512 (setf (classoid-pcl-class lclass
) class
)
514 (!bootstrap-initialize-class
'built-in-class class
515 name class-eq-wrapper nil
518 wrapper prototype
))))))
520 #-sb-fluid
(declaim (inline wrapper-of
))
521 (defun wrapper-of (x)
525 (wrapper-class* (wrapper-of x
)))
527 (defun eval-form (form)
528 (lambda () (eval form
)))
530 (defun ensure-non-standard-class (name &optional existing-class
)
532 ((ensure (metaclass &optional
(slots nil slotsp
))
534 (mapcar #'classoid-name
(classoid-direct-superclasses
535 (find-classoid name
)))))
537 (ensure-class-using-class existing-class name
538 :metaclass metaclass
:name name
539 :direct-superclasses supers
541 (ensure-class-using-class existing-class name
542 :metaclass metaclass
:name name
543 :direct-superclasses supers
))))
544 (slot-initargs-from-structure-slotd (slotd)
545 (let ((accessor (structure-slotd-accessor-symbol slotd
)))
546 `(:name
,(structure-slotd-name slotd
)
547 :defstruct-accessor-symbol
,accessor
548 ,@(when (fboundp accessor
)
549 `(:internal-reader-function
550 ,(structure-slotd-reader-function slotd
)
551 :internal-writer-function
552 ,(structure-slotd-writer-function name slotd
)))
553 :type
,(or (structure-slotd-type slotd
) t
)
554 :initform
,(structure-slotd-init-form slotd
)
555 :initfunction
,(eval-form (structure-slotd-init-form slotd
)))))
556 (slot-initargs-from-condition-slot (slot)
557 `(:name
,(condition-slot-name slot
)
558 :initargs
,(condition-slot-initargs slot
)
559 :readers
,(condition-slot-readers slot
)
560 :writers
,(condition-slot-writers slot
)
561 ,@(when (condition-slot-initform-p slot
)
562 (let ((form-or-fun (condition-slot-initform slot
)))
563 (if (functionp form-or-fun
)
564 `(:initfunction
,form-or-fun
)
565 `(:initform
,form-or-fun
566 :initfunction
,(lambda () form-or-fun
)))))
567 :allocation
,(condition-slot-allocation slot
)
568 :documentation
,(condition-slot-documentation slot
))))
569 (cond ((structure-type-p name
)
570 (ensure 'structure-class
571 (mapcar #'slot-initargs-from-structure-slotd
572 (structure-type-slot-description-list name
))))
573 ((condition-type-p name
)
574 (ensure 'condition-class
575 (mapcar #'slot-initargs-from-condition-slot
576 (condition-classoid-slots (find-classoid name
)))))
578 (error "~@<~S is not the name of a class.~@:>" name
)))))
580 (defun ensure-deffoo-class (classoid)
581 (let ((class (classoid-pcl-class classoid
)))
583 (ensure-non-standard-class (class-name class
) class
))
584 ((eq 'complete
*boot-state
*)
585 (ensure-non-standard-class (classoid-name classoid
))))))
587 (pushnew 'ensure-deffoo-class sb-kernel
::*defstruct-hooks
*)
588 (pushnew 'ensure-deffoo-class sb-kernel
::*define-condition-hooks
*)
590 ;;; FIXME: only needed during bootstrap
591 (defun make-class-predicate (class name
)
592 (let* ((gf (ensure-generic-function name
:lambda-list
'(object)))
593 (mlist (if (eq *boot-state
* 'complete
)
594 (generic-function-methods gf
)
595 (early-gf-methods gf
))))
597 (unless (eq class
*the-class-t
*)
598 (let* ((default-method-function #'constantly-nil
)
599 (default-method-initargs (list :function default-method-function
600 'plist
'(:constant-value nil
)))
601 (default-method (make-a-method
606 default-method-initargs
607 "class predicate default method")))
608 (add-method gf default-method
)))
609 (let* ((class-method-function #'constantly-t
)
610 (class-method-initargs (list :function class-method-function
611 'plist
'(:constant-value t
)))
612 (class-method (make-a-method 'standard-method
616 class-method-initargs
617 "class predicate class method")))
618 (add-method gf class-method
)))
621 ;;; Set the inherits from CPL, and register the layout. This actually
622 ;;; installs the class in the Lisp type system.
623 (defun update-lisp-class-layout (class layout
)
624 (let ((classoid (layout-classoid layout
))
625 (olayout (class-wrapper class
)))
626 (unless (eq (classoid-layout classoid
) layout
)
627 (setf (layout-inherits layout
)
628 (order-layout-inherits
629 (map 'simple-vector
#'class-wrapper
630 (reverse (rest (class-precedence-list class
))))))
631 (register-layout layout
:invalidate t
)
633 ;; FIXME: I don't think this should be necessary, but without it
634 ;; we are unable to compile (TYPEP foo '<class-name>) in the
635 ;; same file as the class is defined. If we had environments,
636 ;; then I think the classsoid whould only be associated with the
637 ;; name in that environment... Alternatively, fix the compiler
638 ;; so that TYPEP foo '<class-name> is slow but compileable.
639 (let ((name (class-name class
)))
640 (when (and name
(symbolp name
) (eq name
(classoid-name classoid
)))
641 (setf (find-classoid name
) classoid
))))))
643 (defun set-class-type-translation (class classoid
)
644 (when (not (typep classoid
'classoid
))
645 (setq classoid
(find-classoid classoid nil
)))
649 (let ((translation (built-in-classoid-translation classoid
)))
652 (aver (ctype-p translation
))
653 (setf (info :type
:translator class
)
654 (lambda (spec) (declare (ignore spec
)) translation
)))
656 (setf (info :type
:translator class
)
657 (lambda (spec) (declare (ignore spec
)) classoid
))))))
659 (setf (info :type
:translator class
)
660 (lambda (spec) (declare (ignore spec
)) classoid
)))))
662 (clrhash *find-class
*)
663 (!bootstrap-meta-braid
)
664 (!bootstrap-accessor-definitions t
)
665 (!bootstrap-class-predicates t
)
666 (!bootstrap-accessor-definitions nil
)
667 (!bootstrap-class-predicates nil
)
668 (!bootstrap-built-in-classes
)
670 (dohash (name x
*find-class
*)
671 (let* ((class (find-class-from-cell name x
))
672 (layout (class-wrapper class
))
673 (lclass (layout-classoid layout
))
674 (lclass-pcl-class (classoid-pcl-class lclass
))
675 (olclass (find-classoid name nil
)))
677 (aver (eq class lclass-pcl-class
))
678 (setf (classoid-pcl-class lclass
) class
))
680 (update-lisp-class-layout class layout
)
683 (aver (eq lclass olclass
)))
685 (setf (find-classoid name
) lclass
)))
687 (set-class-type-translation class name
)))
689 (setq *boot-state
* 'braid
)
691 (defmethod no-applicable-method (generic-function &rest args
)
692 (error "~@<There is no applicable method for the generic function ~2I~_~S~
693 ~I~_when called with arguments ~2I~_~S.~:>"
697 (defmethod no-next-method ((generic-function standard-generic-function
)
698 (method standard-method
) &rest args
)
699 (error "~@<There is no next method for the generic function ~2I~_~S~
700 ~I~_when called from method ~2I~_~S~I~_with arguments ~2I~_~S.~:>"
705 ;;; An extension to the ANSI standard: in the presence of e.g. a
706 ;;; :BEFORE method, it would seem that going through
707 ;;; NO-APPLICABLE-METHOD is prohibited, as in fact there is an
708 ;;; applicable method. -- CSR, 2002-11-15
709 (defmethod no-primary-method (generic-function &rest args
)
710 (error "~@<There is no primary method for the generic function ~2I~_~S~
711 ~I~_when called with arguments ~2I~_~S.~:>"
715 (defmethod invalid-qualifiers ((gf generic-function
)
718 (let ((qualifiers (method-qualifiers method
)))
720 ((cdr qualifiers
) "has too many qualifiers")
721 (t (aver (not (member (car qualifiers
)
722 '(:around
:before
:after
))))
723 "has an invalid qualifier"))))
724 (invalid-method-error
726 "The method ~S on ~S ~A.~%~
727 Standard method combination requires all methods to have one~%~
728 of the single qualifiers :AROUND, :BEFORE and :AFTER or to~%~
729 have no qualifier at all."