From: Nikodemus Siivola Date: Fri, 18 Sep 2009 09:42:38 +0000 (+0000) Subject: 1.0.31.14: removing :DEFAULT-INITARGS via DEFCLASS X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=cccbc9e70fd1c1bacc64b5c77463495192440a66;p=sbcl.git 1.0.31.14: removing :DEFAULT-INITARGS via DEFCLASS * If a DEFCLASS is executed without :DEFAULT-INITARGS, pass :DIRECT-DEFAULT-INITARGS NIL to ENSURE-CLASS. AMOP specifies defaulting direct default initargs for reinitialization using existing CLASS-DIRECT-DEFAULT-INITARGS, but there is no requirement for DEFCLASS to preserve them, and doing that seems quite undesirable -- though I cannot find a requirement from CLHS for removing them either. --- diff --git a/NEWS b/NEWS index 707f189..a9776b0 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,9 @@ changes relative to sbcl-1.0.31 by David Vázquez) * improvement: better error signalling for bogus parameter specializer names in DEFMETHOD forms (reported by Pluijzer) + * bug fix: redefinition of a class via DEFCLASS without :DEFAULT-INITARGS + removes previous default initargs (reported by Lars Rune Nøstdal and + Samium Gromoff) * bug fix: correct WHO-CALLS information for inlined lambdas with complex lambda-lists. (reported by Peter Seibel) * bug fix: SAVE-LISP-AND-DIE option :SAVE-RUNTIME-OPTIONS did not work diff --git a/src/pcl/defclass.lisp b/src/pcl/defclass.lisp index d7870b7..638f561 100644 --- a/src/pcl/defclass.lisp +++ b/src/pcl/defclass.lisp @@ -163,6 +163,8 @@ (push `(:documentation ,(second option)) canonized-options)) (otherwise (push `(',(car option) ',(cdr option)) canonized-options)))) + (unless default-initargs + (push '(:direct-default-initargs nil) canonized-options)) (values (or metaclass 'standard-class) (nreverse canonized-options)))) (defun canonize-defclass-slots (class-name slots env) diff --git a/tests/clos.impure.lisp b/tests/clos.impure.lisp index 2c1f50e..a248cdb 100644 --- a/tests/clos.impure.lisp +++ b/tests/clos.impure.lisp @@ -1753,5 +1753,16 @@ (sb-int:reference-condition-references c) :test #'equal) :ok)))))) + +(defclass remove-default-initargs-test () + ((x :initarg :x :initform 42))) +(defclass remove-default-initatgs-test () + ((x :initarg :x :initform 42)) + (:default-initargs :x 0)) +(defclass remove-default-initargs-test () + ((x :initarg :x :initform 42))) +(with-test (:name :remove-default-initargs) + (assert (= 42 (slot-value (make-instance 'remove-default-initargs-test) + 'x)))) ;;;; success diff --git a/version.lisp-expr b/version.lisp-expr index f8042a4..4393683 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"1.0.31.13" +"1.0.31.14"