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-funcallable-instance-slots (wrapper &optional
56 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 (defun allocate-funcallable-instance (wrapper &optional
65 (slots-init nil slots-init-p))
66 (let ((fin (%make-pcl-funcallable-instance nil nil
67 (get-instance-hash-code))))
68 (set-funcallable-instance-function
70 #'(instance-lambda (&rest args)
71 (declare (ignore args))
72 (error "The function of the funcallable-instance ~S has not been set."
74 (setf (fsc-instance-wrapper fin) wrapper
75 (fsc-instance-slots fin) (allocate-funcallable-instance-slots
76 wrapper slots-init-p slots-init))
79 (defun allocate-structure-instance (wrapper &optional
80 (slots-init nil slots-init-p))
81 (let* ((class (wrapper-class wrapper))
82 (constructor (class-defstruct-constructor class)))
84 (let ((instance (funcall constructor))
85 (slots (class-slots class)))
88 (setf (slot-value-using-class class instance slot)
91 (error "can't allocate an instance of class ~S" (class-name class)))))
93 ;;;; BOOTSTRAP-META-BRAID
95 ;;;; This function builds the base metabraid from the early class definitions.
97 (defmacro !initial-classes-and-wrappers (&rest classes)
99 ,@(mapcar (lambda (class)
100 (let ((wr (intern (format nil "~A-WRAPPER" class)
102 `(setf ,wr ,(if (eq class 'standard-generic-function)
105 (early-class-size ',class)
107 ,class (allocate-standard-instance
108 ,(if (eq class 'standard-generic-function)
109 'funcallable-standard-class-wrapper
110 'standard-class-wrapper))
111 (wrapper-class ,wr) ,class
112 (find-class ',class) ,class)))
115 (defun !bootstrap-meta-braid ()
116 (let* ((*create-classes-from-internal-structure-definitions-p* nil)
117 std-class-wrapper std-class
118 standard-class-wrapper standard-class
119 funcallable-standard-class-wrapper funcallable-standard-class
120 slot-class-wrapper slot-class
121 built-in-class-wrapper built-in-class
122 structure-class-wrapper structure-class
123 condition-class-wrapper condition-class
124 standard-direct-slot-definition-wrapper
125 standard-direct-slot-definition
126 standard-effective-slot-definition-wrapper
127 standard-effective-slot-definition
128 class-eq-specializer-wrapper class-eq-specializer
129 standard-generic-function-wrapper standard-generic-function)
130 (!initial-classes-and-wrappers
131 standard-class funcallable-standard-class
132 slot-class built-in-class structure-class condition-class std-class
133 standard-direct-slot-definition standard-effective-slot-definition
134 class-eq-specializer standard-generic-function)
135 ;; First, make a class metaobject for each of the early classes. For
136 ;; each metaobject we also set its wrapper. Except for the class T,
137 ;; the wrapper is always that of STANDARD-CLASS.
138 (dolist (definition *early-class-definitions*)
139 (let* ((name (ecd-class-name definition))
140 (meta (ecd-metaclass definition))
142 (slot-class slot-class-wrapper)
143 (std-class std-class-wrapper)
144 (standard-class standard-class-wrapper)
145 (funcallable-standard-class
146 funcallable-standard-class-wrapper)
147 (built-in-class built-in-class-wrapper)
148 (structure-class structure-class-wrapper)
149 (condition-class condition-class-wrapper)))
150 (class (or (find-class name nil)
151 (allocate-standard-instance wrapper))))
152 (setf (find-class name) class)))
153 (dolist (definition *early-class-definitions*)
154 (let ((name (ecd-class-name definition))
155 (meta (ecd-metaclass definition))
156 (source (ecd-source definition))
157 (direct-supers (ecd-superclass-names definition))
158 (direct-slots (ecd-canonical-slots definition))
159 (other-initargs (ecd-other-initargs definition)))
160 (let ((direct-default-initargs
161 (getf other-initargs :direct-default-initargs)))
162 (multiple-value-bind (slots cpl default-initargs direct-subclasses)
163 (early-collect-inheritance name)
164 (let* ((class (find-class name))
165 (wrapper (cond ((eq class slot-class)
167 ((eq class std-class)
169 ((eq class standard-class)
170 standard-class-wrapper)
171 ((eq class funcallable-standard-class)
172 funcallable-standard-class-wrapper)
173 ((eq class standard-direct-slot-definition)
174 standard-direct-slot-definition-wrapper)
176 standard-effective-slot-definition)
177 standard-effective-slot-definition-wrapper)
178 ((eq class built-in-class)
179 built-in-class-wrapper)
180 ((eq class structure-class)
181 structure-class-wrapper)
182 ((eq class condition-class)
183 condition-class-wrapper)
184 ((eq class class-eq-specializer)
185 class-eq-specializer-wrapper)
186 ((eq class standard-generic-function)
187 standard-generic-function-wrapper)
189 (boot-make-wrapper (length slots) name))))
191 (when (eq name t) (setq *the-wrapper-of-t* wrapper))
192 (set (intern (format nil "*THE-CLASS-~A*" (symbol-name name))
196 (unless (eq (getf slot :allocation :instance) :instance)
197 (error "Slot allocation ~S is not supported in bootstrap."
198 (getf slot :allocation))))
200 (when (typep wrapper 'wrapper)
201 (setf (wrapper-instance-slots-layout wrapper)
202 (mapcar #'canonical-slot-name slots))
203 (setf (wrapper-class-slots wrapper)
206 (setq proto (if (eq meta 'funcallable-standard-class)
207 (allocate-funcallable-instance wrapper)
208 (allocate-standard-instance wrapper)))
211 (!bootstrap-make-slot-definitions
212 name class direct-slots
213 standard-direct-slot-definition-wrapper nil))
215 (!bootstrap-make-slot-definitions
217 standard-effective-slot-definition-wrapper t))
220 ((std-class standard-class funcallable-standard-class)
221 (!bootstrap-initialize-class
223 class name class-eq-specializer-wrapper source
224 direct-supers direct-subclasses cpl wrapper proto
225 direct-slots slots direct-default-initargs default-initargs))
226 (built-in-class ; *the-class-t*
227 (!bootstrap-initialize-class
229 class name class-eq-specializer-wrapper source
230 direct-supers direct-subclasses cpl wrapper proto))
231 (slot-class ; *the-class-slot-object*
232 (!bootstrap-initialize-class
234 class name class-eq-specializer-wrapper source
235 direct-supers direct-subclasses cpl wrapper proto))
236 (structure-class ; *the-class-structure-object*
237 (!bootstrap-initialize-class
239 class name class-eq-specializer-wrapper source
240 direct-supers direct-subclasses cpl wrapper))
242 (!bootstrap-initialize-class
244 class name class-eq-specializer-wrapper source
245 direct-supers direct-subclasses cpl wrapper))))))))
247 (let* ((smc-class (find-class 'standard-method-combination))
248 (smc-wrapper (!bootstrap-get-slot 'standard-class
251 (smc (allocate-standard-instance smc-wrapper)))
252 (flet ((set-slot (name value)
253 (!bootstrap-set-slot 'standard-method-combination
257 (set-slot 'source *load-pathname*)
258 (set-slot 'type 'standard)
259 (set-slot 'documentation "The standard method combination.")
260 (set-slot 'options ()))
261 (setq *standard-method-combination* smc))))
263 ;;; Initialize a class metaobject.
264 (defun !bootstrap-initialize-class
265 (metaclass-name class name
266 class-eq-wrapper source direct-supers direct-subclasses cpl wrapper
269 direct-slots slots direct-default-initargs default-initargs)
270 (flet ((classes (names) (mapcar #'find-class names))
271 (set-slot (slot-name value)
272 (!bootstrap-set-slot metaclass-name class slot-name value)))
273 (set-slot 'name name)
274 (set-slot 'finalized-p t)
275 (set-slot 'source source)
276 (set-slot 'type (if (eq class (find-class t))
278 ;; FIXME: Could this just be CLASS instead
279 ;; of `(CLASS ,CLASS)? If not, why not?
280 ;; (See also similar expression in
281 ;; SHARED-INITIALIZE :BEFORE (CLASS).)
283 (set-slot 'class-eq-specializer
284 (let ((spec (allocate-standard-instance class-eq-wrapper)))
285 (!bootstrap-set-slot 'class-eq-specializer spec 'type
287 (!bootstrap-set-slot 'class-eq-specializer spec 'object
290 (set-slot 'class-precedence-list (classes cpl))
291 (set-slot 'can-precede-list (classes (cdr cpl)))
292 (set-slot 'incompatible-superclass-list nil)
293 (set-slot 'direct-superclasses (classes direct-supers))
294 (set-slot 'direct-subclasses (classes direct-subclasses))
295 (set-slot 'direct-methods (cons nil nil))
296 (set-slot 'wrapper wrapper)
297 (set-slot 'predicate-name (or (cadr (assoc name *early-class-predicates*))
298 (make-class-predicate-name name)))
299 (set-slot 'documentation nil)
301 `(,@(and direct-default-initargs
302 `(direct-default-initargs ,direct-default-initargs))
303 ,@(and default-initargs
304 `(default-initargs ,default-initargs))))
305 (when (memq metaclass-name '(standard-class funcallable-standard-class
306 structure-class condition-class
307 slot-class std-class))
308 (set-slot 'direct-slots direct-slots)
309 (set-slot 'slots slots))
311 ;; For all direct superclasses SUPER of CLASS, make sure CLASS is
312 ;; a direct subclass of SUPER. Note that METACLASS-NAME doesn't
313 ;; matter here for the slot DIRECT-SUBCLASSES, since every class
314 ;; inherits the slot from class CLASS.
315 (dolist (super direct-supers)
316 (let* ((super (find-class super))
317 (subclasses (!bootstrap-get-slot metaclass-name super
318 'direct-subclasses)))
319 (cond ((eq +slot-unbound+ subclasses)
320 (!bootstrap-set-slot metaclass-name super 'direct-subclasses
322 ((not (memq class subclasses))
323 (!bootstrap-set-slot metaclass-name super 'direct-subclasses
324 (cons class subclasses))))))
328 (let ((constructor-sym '|STRUCTURE-OBJECT class constructor|))
329 (set-slot 'predicate-name (or (cadr (assoc name
330 *early-class-predicates*))
331 (make-class-predicate-name name)))
332 (set-slot 'defstruct-form
333 `(defstruct (structure-object (:constructor
336 (set-slot 'defstruct-constructor constructor-sym)
337 (set-slot 'from-defclass-p t)
338 (set-slot 'plist nil)
339 (set-slot 'prototype (funcall constructor-sym))))
341 (set-slot 'prototype (make-condition name)))
344 (if proto-p proto (allocate-standard-instance wrapper)))))
347 (defun !bootstrap-make-slot-definitions (name class slots wrapper effective-p)
349 (mapcar (lambda (slot)
351 (!bootstrap-make-slot-definition
352 name class slot wrapper effective-p index))
355 (defun !bootstrap-make-slot-definition
356 (name class slot wrapper effective-p index)
357 (let* ((slotd-class-name (if effective-p
358 'standard-effective-slot-definition
359 'standard-direct-slot-definition))
360 (slotd (allocate-standard-instance wrapper))
361 (slot-name (getf slot :name)))
362 (flet ((get-val (name) (getf slot name))
364 (!bootstrap-set-slot slotd-class-name slotd name val)))
365 (set-val 'name slot-name)
366 (set-val 'initform (get-val :initform))
367 (set-val 'initfunction (get-val :initfunction))
368 (set-val 'initargs (get-val :initargs))
369 (set-val 'readers (get-val :readers))
370 (set-val 'writers (get-val :writers))
371 (set-val 'allocation :instance)
372 (set-val 'type (or (get-val :type) t))
373 (set-val 'documentation (or (get-val :documentation) ""))
374 (set-val 'class class)
376 (set-val 'location index)
378 (set-val 'reader-function (make-optimized-std-reader-method-function
379 fsc-p slot-name index))
380 (set-val 'writer-function (make-optimized-std-writer-method-function
381 fsc-p slot-name index))
382 (set-val 'boundp-function (make-optimized-std-boundp-method-function
383 fsc-p slot-name index)))
384 (set-val 'accessor-flags 7)
385 (let ((table (or (gethash slot-name *name->class->slotd-table*)
386 (setf (gethash slot-name *name->class->slotd-table*)
387 (make-hash-table :test 'eq :size 5)))))
388 (setf (gethash class table) slotd)))
389 (when (and (eq name 'standard-class)
390 (eq slot-name 'slots) effective-p)
391 (setq *the-eslotd-standard-class-slots* slotd))
392 (when (and (eq name 'funcallable-standard-class)
393 (eq slot-name 'slots) effective-p)
394 (setq *the-eslotd-funcallable-standard-class-slots* slotd))
397 (defun !bootstrap-accessor-definitions (early-p)
398 (let ((*early-p* early-p))
399 (dolist (definition *early-class-definitions*)
400 (let ((name (ecd-class-name definition))
401 (meta (ecd-metaclass definition)))
402 (unless (eq meta 'built-in-class)
403 (let ((direct-slots (ecd-canonical-slots definition)))
404 (dolist (slotd direct-slots)
405 (let ((slot-name (getf slotd :name))
406 (readers (getf slotd :readers))
407 (writers (getf slotd :writers)))
408 (!bootstrap-accessor-definitions1
414 (!bootstrap-accessor-definitions1
417 (list (slot-reader-name slot-name))
418 (list (slot-writer-name slot-name))
419 (list (slot-boundp-name slot-name)))))))))))
421 (defun !bootstrap-accessor-definition (class-name accessor-name slot-name type)
422 (multiple-value-bind (accessor-class make-method-function arglist specls doc)
424 (reader (values 'standard-reader-method
425 #'make-std-reader-method-function
428 "automatically generated reader method"))
429 (writer (values 'standard-writer-method
430 #'make-std-writer-method-function
431 (list 'new-value class-name)
433 "automatically generated writer method"))
434 (boundp (values 'standard-boundp-method
435 #'make-std-boundp-method-function
438 "automatically generated boundp method")))
439 (let ((gf (ensure-generic-function accessor-name
440 :lambda-list arglist)))
441 (if (find specls (early-gf-methods gf)
442 :key #'early-method-specializers
444 (unless (assoc accessor-name *!generic-function-fixups*
448 (make-a-method accessor-class
451 (funcall make-method-function
452 class-name slot-name)
456 (defun !bootstrap-accessor-definitions1 (class-name
461 (flet ((do-reader-definition (reader)
462 (!bootstrap-accessor-definition class-name
466 (do-writer-definition (writer)
467 (!bootstrap-accessor-definition class-name
471 (do-boundp-definition (boundp)
472 (!bootstrap-accessor-definition class-name
476 (dolist (reader readers) (do-reader-definition reader))
477 (dolist (writer writers) (do-writer-definition writer))
478 (dolist (boundp boundps) (do-boundp-definition boundp))))
480 (defun !bootstrap-class-predicates (early-p)
481 (let ((*early-p* early-p))
482 (dolist (definition *early-class-definitions*)
483 (let* ((name (ecd-class-name definition))
484 (class (find-class name)))
485 (setf (find-class-predicate name)
486 (make-class-predicate class (class-predicate-name class)))))))
488 (defun !bootstrap-built-in-classes ()
490 ;; First make sure that all the supers listed in
491 ;; *BUILT-IN-CLASS-LATTICE* are themselves defined by
492 ;; *BUILT-IN-CLASS-LATTICE*. This is just to check for typos and
493 ;; other sorts of brainos.
494 (dolist (e *built-in-classes*)
495 (dolist (super (cadr e))
496 (unless (or (eq super t)
497 (assq super *built-in-classes*))
498 (error "in *BUILT-IN-CLASSES*: ~S has ~S as a super,~%~
499 but ~S is not itself a class in *BUILT-IN-CLASSES*."
500 (car e) super super))))
502 ;; In the first pass, we create a skeletal object to be bound to the
504 (let* ((built-in-class (find-class 'built-in-class))
505 (built-in-class-wrapper (class-wrapper built-in-class)))
506 (dolist (e *built-in-classes*)
507 (let ((class (allocate-standard-instance built-in-class-wrapper)))
508 (setf (find-class (car e)) class))))
510 ;; In the second pass, we initialize the class objects.
511 (let ((class-eq-wrapper (class-wrapper (find-class 'class-eq-specializer))))
512 (dolist (e *built-in-classes*)
513 (destructuring-bind (name supers subs cpl prototype) e
514 (let* ((class (find-class name))
515 (lclass (find-classoid name))
516 (wrapper (classoid-layout lclass)))
517 (set (get-built-in-class-symbol name) class)
518 (set (get-built-in-wrapper-symbol name) wrapper)
519 (setf (classoid-pcl-class lclass) class)
521 (!bootstrap-initialize-class 'built-in-class class
522 name class-eq-wrapper nil
525 wrapper prototype)))))
527 (dolist (e *built-in-classes*)
528 (let* ((name (car e))
529 (class (find-class name)))
530 (setf (find-class-predicate name)
531 (make-class-predicate class (class-predicate-name class))))))
533 (defmacro wrapper-of-macro (x)
537 (wrapper-class* (wrapper-of-macro x)))
539 ;;; FIXME: We probably don't need both WRAPPER-OF and WRAPPER-OF-MACRO.
540 #-sb-fluid (declaim (inline wrapper-of))
541 (defun wrapper-of (x)
542 (wrapper-of-macro x))
544 (defun eval-form (form)
545 (lambda () (eval form)))
547 (defun ensure-non-standard-class (name &optional existing-class)
549 ((ensure (metaclass &optional (slots nil slotsp))
551 (mapcar #'classoid-name (classoid-direct-superclasses
552 (find-classoid name)))))
554 (ensure-class-using-class existing-class name
555 :metaclass metaclass :name name
556 :direct-superclasses supers
558 (ensure-class-using-class existing-class name
559 :metaclass metaclass :name name
560 :direct-superclasses supers))))
561 (slot-initargs-from-structure-slotd (slotd)
562 (let ((accessor (structure-slotd-accessor-symbol slotd)))
563 `(:name ,(structure-slotd-name slotd)
564 :defstruct-accessor-symbol ,accessor
565 ,@(when (fboundp accessor)
566 `(:internal-reader-function
567 ,(structure-slotd-reader-function slotd)
568 :internal-writer-function
569 ,(structure-slotd-writer-function name slotd)))
570 :type ,(or (structure-slotd-type slotd) t)
571 :initform ,(structure-slotd-init-form slotd)
572 :initfunction ,(eval-form (structure-slotd-init-form slotd)))))
573 (slot-initargs-from-condition-slot (slot)
574 `(:name ,(condition-slot-name slot)
575 :initargs ,(condition-slot-initargs slot)
576 :readers ,(condition-slot-readers slot)
577 :writers ,(condition-slot-writers slot)
578 ,@(when (condition-slot-initform-p slot)
579 (let ((form-or-fun (condition-slot-initform slot)))
580 (if (functionp form-or-fun)
581 `(:initfunction ,form-or-fun)
582 `(:initform ,form-or-fun
583 :initfunction ,(lambda () form-or-fun)))))
584 :allocation (condition-slot-allocation slot)
585 :documentation (condition-slot-documentation slot))))
586 (cond ((structure-type-p name)
587 (ensure 'structure-class
588 (mapcar #'slot-initargs-from-structure-slotd
589 (structure-type-slot-description-list name))))
590 ((condition-type-p name)
591 (ensure 'condition-class
592 (mapcar #'slot-initargs-from-condition-slot
593 (condition-classoid-slots (find-classoid name)))))
595 (error "~@<~S is not the name of a class.~@:>" name)))))
597 (defun maybe-reinitialize-structure-class (classoid)
598 (let ((class (classoid-pcl-class classoid)))
600 (ensure-non-standard-class (class-name class) class))))
602 (pushnew 'maybe-reinitialize-structure-class sb-kernel::*defstruct-hooks*)
604 (defun make-class-predicate (class name)
605 (let* ((gf (ensure-generic-function name :lambda-list '(object)))
606 (mlist (if (eq *boot-state* 'complete)
607 (generic-function-methods gf)
608 (early-gf-methods gf))))
610 (unless (eq class *the-class-t*)
611 (let* ((default-method-function #'constantly-nil)
612 (default-method-initargs (list :function
613 default-method-function))
614 (default-method (make-a-method
619 default-method-initargs
620 "class predicate default method")))
621 (setf (method-function-get default-method-function :constant-value)
623 (add-method gf default-method)))
624 (let* ((class-method-function #'constantly-t)
625 (class-method-initargs (list :function
626 class-method-function))
627 (class-method (make-a-method 'standard-method
631 class-method-initargs
632 "class predicate class method")))
633 (setf (method-function-get class-method-function :constant-value) t)
634 (add-method gf class-method)))
637 ;;; Set the inherits from CPL, and register the layout. This actually
638 ;;; installs the class in the Lisp type system.
639 (defun update-lisp-class-layout (class layout)
640 (let ((lclass (layout-classoid layout)))
641 (unless (eq (classoid-layout lclass) layout)
642 (setf (layout-inherits layout)
643 (order-layout-inherits
644 (map 'simple-vector #'class-wrapper
645 (reverse (rest (class-precedence-list class))))))
646 (register-layout layout :invalidate t)
648 ;; Subclasses of formerly forward-referenced-class may be
649 ;; unknown to CL:FIND-CLASS and also anonymous. This
650 ;; functionality moved here from (SETF FIND-CLASS).
651 (let ((name (class-name class)))
652 (setf (find-classoid name) lclass
653 (classoid-name lclass) name)))))
655 (defun set-class-type-translation (class name)
656 (let ((classoid (find-classoid name nil)))
660 (let ((translation (built-in-classoid-translation classoid)))
663 (aver (ctype-p translation))
664 (setf (info :type :translator class)
665 (lambda (spec) (declare (ignore spec)) translation)))
667 (setf (info :type :translator class)
668 (lambda (spec) (declare (ignore spec)) classoid))))))
670 (setf (info :type :translator class)
671 (lambda (spec) (declare (ignore spec)) classoid))))))
673 (clrhash *find-class*)
674 (!bootstrap-meta-braid)
675 (!bootstrap-accessor-definitions t)
676 (!bootstrap-class-predicates t)
677 (!bootstrap-accessor-definitions nil)
678 (!bootstrap-class-predicates nil)
679 (!bootstrap-built-in-classes)
681 (dohash (name x *find-class*)
682 (let* ((class (find-class-from-cell name x))
683 (layout (class-wrapper class))
684 (lclass (layout-classoid layout))
685 (lclass-pcl-class (classoid-pcl-class lclass))
686 (olclass (find-classoid name nil)))
688 (aver (eq class lclass-pcl-class))
689 (setf (classoid-pcl-class lclass) class))
691 (update-lisp-class-layout class layout)
694 (aver (eq lclass olclass)))
696 (setf (find-classoid name) lclass)))
698 (set-class-type-translation class name)))
700 (setq *boot-state* 'braid)
702 (defmethod no-applicable-method (generic-function &rest args)
703 (error "~@<There is no applicable method for the generic function ~2I~_~S~
704 ~I~_when called with arguments ~2I~_~S.~:>"
708 (defmethod no-next-method ((generic-function standard-generic-function)
709 (method standard-method) &rest args)
710 (error "~@<There is no next method for the generic function ~2I~_~S~
711 ~I~_when called from method ~2I~_~S~I~_with arguments ~2I~_~S.~:>"
716 ;;; An extension to the ANSI standard: in the presence of e.g. a
717 ;;; :BEFORE method, it would seem that going through
718 ;;; NO-APPLICABLE-METHOD is prohibited, as in fact there is an
719 ;;; applicable method. -- CSR, 2002-11-15
720 (defmethod no-primary-method (generic-function &rest args)
721 (error "~@<There is no primary method for the generic function ~2I~_~S~
722 ~I~_when called with arguments ~2I~_~S.~:>"
726 (defmethod invalid-qualifiers ((gf generic-function)
729 (let ((qualifiers (method-qualifiers method)))
731 ((cdr qualifiers) "has too many qualifiers")
732 (t (aver (not (member (car qualifiers)
733 '(:around :before :after))))
734 "has an invalid qualifier"))))
735 (invalid-method-error
737 "The method ~S on ~S ~A.~%~
738 Standard method combination requires all methods to have one~%~
739 of the single qualifiers :AROUND, :BEFORE and :AFTER or to~%~
740 have no qualifier at all."