;; full-blown class, so the "a class of this name is
;; coming" note we write here would be irrelevant.
(eval-when (:compile-toplevel)
;; full-blown class, so the "a class of this name is
;; coming" note we write here would be irrelevant.
(eval-when (:compile-toplevel)
',*readers-for-this-defclass*
',*writers-for-this-defclass*
',*slot-names-for-this-defclass*))
',*readers-for-this-defclass*
',*writers-for-this-defclass*
',*slot-names-for-this-defclass*))
(maplist (lambda (sublist)
(let ((option-name (first (pop sublist))))
(when (member option-name sublist :key #'first)
(maplist (lambda (sublist)
(let ((option-name (first (pop sublist))))
(when (member option-name sublist :key #'first)
(let ((maybe-metaclass (second option)))
(unless (and maybe-metaclass (legal-class-name-p maybe-metaclass))
(error "~@<The value of the :metaclass option (~S) ~
(let ((maybe-metaclass (second option)))
(unless (and maybe-metaclass (legal-class-name-p maybe-metaclass))
(error "~@<The value of the :metaclass option (~S) ~
(let (initargs arg-names)
(doplist (key val) (cdr option)
(when (member key arg-names)
(let (initargs arg-names)
(doplist (key val) (cdr option)
(when (member key arg-names)
- (push ``(,',key ,,(make-initfunction val) ,',val) initargs))
+ (push ``(,',key ,',val ,,(make-initfunction val)) initargs))
:format-control "Slot initarg name ~S for slot ~S in ~
DEFCLASS ~S is not a symbol."
:format-arguments (list val name class-name)))
:format-control "Slot initarg name ~S for slot ~S in ~
DEFCLASS ~S is not a symbol."
:format-arguments (list val name class-name)))
:format-arguments (list key name class-name))))
;; For non-standard options multiple entries go in a list
(push val (getf others key))))))
:format-arguments (list key name class-name))))
;; For non-standard options multiple entries go in a list
(push val (getf others key))))))
:format-control "Multiple slots named ~S in DEFCLASS ~S."
:format-arguments (list name class-name))))))
(defun make-initfunction (initform)
(cond ((or (eq initform t)
:format-control "Multiple slots named ~S in DEFCLASS ~S."
:format-arguments (list name class-name))))))
(defun make-initfunction (initform)
(cond ((or (eq initform t)
- (equal initform ''t))
- '(function constantly-t))
- ((or (eq initform nil)
- (equal initform ''nil))
- '(function constantly-nil))
- ((or (eql initform 0)
- (equal initform ''0))
- '(function constantly-0))
- (t
- (let ((entry (assoc initform *initfunctions-for-this-defclass*
- :test #'equal)))
- (unless entry
- (setq entry (list initform
- (gensym)
- `(function (lambda () ,initform))))
- (push entry *initfunctions-for-this-defclass*))
- (cadr entry)))))
+ (equal initform ''t))
+ '(function constantly-t))
+ ((or (eq initform nil)
+ (equal initform ''nil))
+ '(function constantly-nil))
+ ((or (eql initform 0)
+ (equal initform ''0))
+ '(function constantly-0))
+ (t
+ (let ((entry (assoc initform *initfunctions-for-this-defclass*
+ :test #'equal)))
+ (unless entry
+ (setq entry (list initform
+ (gensym)
+ `(function (lambda () ,initform))))
+ (push entry *initfunctions-for-this-defclass*))
+ (cadr entry)))))
(defun %compiler-defclass (name readers writers slots)
;; ANSI says (Macro DEFCLASS, section 7.7) that DEFCLASS, if it
(defun %compiler-defclass (name readers writers slots)
;; ANSI says (Macro DEFCLASS, section 7.7) that DEFCLASS, if it
- (let ((a (cons class-name
- (mapcar #'canonical-slot-name
- (early-collect-inheritance class-name)))))
- (push a *early-class-slots*)
- a))))
+ (let ((a (cons class-name
+ (mapcar #'canonical-slot-name
+ (early-collect-inheritance class-name)))))
+ (push a *early-class-slots*)
+ a))))
;;(declare (values slots cpl default-initargs direct-subclasses))
(let ((cpl (early-collect-cpl class-name)))
(values (early-collect-slots cpl)
;;(declare (values slots cpl default-initargs direct-subclasses))
(let ((cpl (early-collect-cpl class-name)))
(values (early-collect-slots cpl)
- cpl
- (early-collect-default-initargs cpl)
- (let (collect)
- (dolist (definition *early-class-definitions*)
- (when (memq class-name (ecd-superclass-names definition))
- (push (ecd-class-name definition) collect)))
+ cpl
+ (early-collect-default-initargs cpl)
+ (let (collect)
+ (dolist (definition *early-class-definitions*)
+ (when (memq class-name (ecd-superclass-names definition))
+ (push (ecd-class-name definition) collect)))
- (super-slots (mapcar #'ecd-canonical-slots definitions))
- (slots (apply #'append (reverse super-slots))))
+ (super-slots (mapcar #'ecd-canonical-slots definitions))
+ (slots (apply #'append (reverse super-slots))))
- (dolist (s2 (cdr (memq s1 slots)))
- (when (eq name1 (canonical-slot-name s2))
- (error "More than one early class defines a slot with the~%~
- name ~S. This can't work because the bootstrap~%~
- object system doesn't know how to compute effective~%~
- slots."
- name1)))))
+ (dolist (s2 (cdr (memq s1 slots)))
+ (when (eq name1 (canonical-slot-name s2))
+ (error "More than one early class defines a slot with the~%~
+ name ~S. This can't work because the bootstrap~%~
+ object system doesn't know how to compute effective~%~
+ slots."
+ name1)))))
- (let* ((definition (early-class-definition c))
- (supers (ecd-superclass-names definition)))
- (cons c
- (apply #'append (mapcar #'early-collect-cpl supers))))))
+ (let* ((definition (early-class-definition c))
+ (supers (ecd-superclass-names definition)))
+ (cons c
+ (apply #'append (mapcar #'early-collect-cpl supers))))))
(remove-duplicates (walk class-name) :from-end nil :test #'eq)))
(defun early-collect-default-initargs (cpl)
(let ((default-initargs ()))
(dolist (class-name cpl)
(let* ((definition (early-class-definition class-name))
(remove-duplicates (walk class-name) :from-end nil :test #'eq)))
(defun early-collect-default-initargs (cpl)
(let ((default-initargs ()))
(dolist (class-name cpl)
(let* ((definition (early-class-definition class-name))
- (others (ecd-other-initargs definition)))
- (loop (when (null others) (return nil))
- (let ((initarg (pop others)))
- (unless (eq initarg :direct-default-initargs)
- (error "~@<The defclass option ~S is not supported by ~
- the bootstrap object system.~:@>"
- initarg)))
- (setq default-initargs
- (nconc default-initargs (reverse (pop others)))))))
+ (others (ecd-other-initargs definition)))
+ (loop (when (null others) (return nil))
+ (let ((initarg (pop others)))
+ (unless (eq initarg :direct-default-initargs)
+ (error "~@<The defclass option ~S is not supported by ~
+ the bootstrap object system.~:@>"
+ initarg)))
+ (setq default-initargs
+ (nconc default-initargs (reverse (pop others)))))))
;;; by the full object system later.
(defmacro !bootstrap-get-slot (type object slot-name)
`(clos-slots-ref (get-slots ,object)
;;; by the full object system later.
(defmacro !bootstrap-get-slot (type object slot-name)
`(clos-slots-ref (get-slots ,object)
(defun !bootstrap-set-slot (type object slot-name new-value)
(setf (!bootstrap-get-slot type object slot-name) new-value))
(defun !bootstrap-set-slot (type object slot-name new-value)
(setf (!bootstrap-get-slot type object slot-name) new-value))
readers writers slot-names)
(%compiler-defclass name readers writers slot-names)
(setq supers (copy-tree supers)
readers writers slot-names)
(%compiler-defclass name readers writers slot-names)
(setq supers (copy-tree supers)