1.0.31.14: removing :DEFAULT-INITARGS via DEFCLASS
authorNikodemus Siivola <nikodemus@random-state.net>
Fri, 18 Sep 2009 09:42:38 +0000 (09:42 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Fri, 18 Sep 2009 09:42:38 +0000 (09:42 +0000)
 * 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.

NEWS
src/pcl/defclass.lisp
tests/clos.impure.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index 707f189..a9776b0 100644 (file)
--- 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
index d7870b7..638f561 100644 (file)
            (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)
index 2c1f50e..a248cdb 100644 (file)
                                 (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))))
 \f
 ;;;; success
index f8042a4..4393683 100644 (file)
@@ -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"