;; However, after playing around a little, I couldn't find that
;; way, so I've left it as is, but if someone does come up with a
;; better way... -- CSR, 2002-09-08
- (loop for (slot . more) on (getf initargs :direct-slots)
- for slot-name = (getf slot :name)
- if (some (lambda (s) (eq slot-name (getf s :name))) more)
- ;; FIXME: It's quite possible that we ought to define an
- ;; SB-INT:PROGRAM-ERROR function to signal these and other
- ;; errors throughout the code base that are required to be
- ;; of type PROGRAM-ERROR.
- do (error 'simple-program-error
- :format-control "More than one direct slot with name ~S."
- :format-arguments (list slot-name))
- else
- do (loop for (option value . more) on slot by #'cddr
- when (and (member option
- '(:allocation :type
+ (do ((direct-slots (getf initargs :direct-slots) (cdr direct-slots)))
+ ((endp direct-slots) nil)
+ (destructuring-bind (slot &rest more) direct-slots
+ (let ((slot-name (getf slot :name)))
+ (when (some (lambda (s) (eq slot-name (getf s :name))) more)
+ ;; FIXME: It's quite possible that we ought to define an
+ ;; SB-INT:PROGRAM-ERROR function to signal these and other
+ ;; errors throughout the codebase that are required to be
+ ;; of type PROGRAM-ERROR.
+ (error 'simple-program-error
+ :format-control "~@<There is more than one direct slot ~
+ with name ~S.~:>"
+ :format-arguments (list slot-name)))
+ (do ((stuff slot (cddr stuff)))
+ ((endp stuff) nil)
+ (destructuring-bind (option value &rest more) stuff
+ (cond
+ ((and (member option '(:allocation :type
:initform :documentation))
- (not (eq unsupplied
- (getf more option unsupplied))))
- do (error 'simple-program-error
- :format-control "Duplicate slot option ~S for slot ~S."
- :format-arguments (list option slot-name))))
+ (not (eq unsupplied
+ (getf more option unsupplied))))
+ (error 'simple-program-error
+ :format-control "~@<Duplicate slot option ~S for ~
+ slot named ~S.~:>"
+ :format-arguments (list option slot-name)))
+ ((and (eq option :readers)
+ (notevery #'symbolp value))
+ (error 'simple-program-error
+ :format-control "~@<Slot reader names for slot ~
+ named ~S must be symbols.~:>"
+ :format-arguments (list slot-name)))
+ ((and (eq option :initargs)
+ (notevery #'symbolp value))
+ (error 'simple-program-error
+ :format-control "~@<Slot initarg names for slot ~
+ named ~S must be symbols.~:>"
+ :format-arguments (list slot-name)))))))))
(loop for (initarg . more) on (getf initargs :direct-default-initargs)
for name = (car initarg)
when (some (lambda (a) (eq (car a) name)) more)
do (error 'simple-program-error
- :format-control "Duplicate initialization argument ~
- name ~S in :default-initargs of class ~A."
+ :format-control "~@<Duplicate initialization argument ~
+ name ~S in :DEFAULT-INITARGS.~:>"
:format-arguments (list name class)))
- (loop (unless (remf initargs :metaclass) (return)))
+ (let ((metaclass 0)
+ (default-initargs 0))
+ (do ((args initargs (cddr args)))
+ ((endp args) nil)
+ (case (car args)
+ (:metaclass
+ (when (> (incf metaclass) 1)
+ (error 'simple-program-error
+ :format-control "~@<More than one :METACLASS ~
+ option specified.~:>")))
+ (:direct-default-initargs
+ (when (> (incf default-initargs) 1)
+ (error 'simple-program-error
+ :format-control "~@<More than one :DEFAULT-INITARGS ~
+ option specified.~:>"))))))
+ (remf initargs :metaclass)
(loop (unless (remf initargs :direct-superclasses) (return)))
(loop (unless (remf initargs :direct-slots) (return)))
(values meta
+slot-unbound+))
direct-slots)))
(reader-names (mapcar (lambda (slotd)
- (intern (format nil
- "~A~A reader"
- conc-name
- (slot-definition-name
- slotd))))
+ (list 'slot-accessor name
+ (slot-definition-name slotd)
+ 'reader))
direct-slots))
(writer-names (mapcar (lambda (slotd)
- (intern (format nil
- "~A~A writer"
- conc-name
- (slot-definition-name
- slotd))))
+ (list 'slot-accessor name
+ (slot-definition-name slotd)
+ 'writer))
direct-slots))
(readers-init
(mapcar (lambda (slotd reader-name)
(update-slots class (compute-slots class))
(update-gfs-of-class class)
(update-inits class (compute-default-initargs class))
- (update-make-instance-function-table class))
+ (update-ctors 'finalize-inheritance :class class))
(unless finalizep
(dolist (sub (class-direct-subclasses class)) (update-class sub nil))))