X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fpcl%2Finit.lisp;h=6696bbaac304ff422a8f2cf2f5df44fe9f51db46;hb=d25e3478acccec70402ff32554669a982be8e281;hp=912c197dc8561908b64fbae832f2321321aa8333;hpb=203b88cf40ed2e15ec0f36dc53ad188b091d9ab2;p=sbcl.git diff --git a/src/pcl/init.lisp b/src/pcl/init.lisp index 912c197..6696bba 100644 --- a/src/pcl/init.lisp +++ b/src/pcl/init.lisp @@ -110,34 +110,29 @@ ;; that slot won't be initialized from its :INITFORM, if any. (let ((initfun (slot-definition-initfunction slotd))) (if (typep instance 'structure-object) - (when (eq (funcall - ;; not SLOT-VALUE-USING-CLASS, as that - ;; throws an error if the value is the - ;; unbound marker. - (slot-definition-internal-reader-function slotd) - instance) - +slot-unbound+) + ;; We don't have a consistent unbound marker for structure + ;; object slots, and structure object redefinition is not + ;; really supported anyways -- so unconditionally + ;; initializing the slot should be fine. + (when initfun (setf (slot-value-using-class class instance slotd) - (when initfun - (funcall initfun)))) + (funcall initfun))) (unless (or (not initfun) (slot-boundp-using-class class instance slotd)) - (setf (slot-value-using-class class instance slotd) - (funcall initfun))))))) + (setf (slot-value-using-class class instance slotd) + (funcall initfun))))))) (let* ((class (class-of instance)) (initfn-slotds (loop for slotd in (class-slots class) unless (initialize-slot-from-initarg class instance slotd) collect slotd))) (dolist (slotd initfn-slotds) - (if (eq (slot-definition-allocation slotd) :class) - (when (or (eq t slot-names) - (memq (slot-definition-name slotd) slot-names)) - (unless (slot-boundp-using-class class instance slotd) - (initialize-slot-from-initfunction class instance slotd))) - (when (or (eq t slot-names) - (memq (slot-definition-name slotd) slot-names)) - (initialize-slot-from-initfunction class instance slotd))))) + (unless (eq (slot-definition-allocation slotd) :class) + ;; :ALLOCATION :CLASS slots use the :INITFORM when class is defined + ;; or redefined, not when instances are allocated. + (when (or (eq t slot-names) + (memq (slot-definition-name slotd) slot-names)) + (initialize-slot-from-initfunction class instance slotd))))) instance)) ;;; If initargs are valid return nil, otherwise signal an error.