0.8.17.2: eager creation of CLOS classes for user defined structures
authorNikodemus Siivola <nikodemus@random-state.net>
Mon, 29 Nov 2004 11:07:54 +0000 (11:07 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Mon, 29 Nov 2004 11:07:54 +0000 (11:07 +0000)
           * aka bug #331

BUGS
NEWS
src/pcl/braid.lisp
tests/mop.impure.lisp
version.lisp-expr

diff --git a/BUGS b/BUGS
index 48ca825..6252eed 100644 (file)
--- a/BUGS
+++ b/BUGS
@@ -1305,12 +1305,6 @@ WORKAROUND:
      in the wrapper, and then to update the instance just run through
      all the old wrappers in order from oldest to newest.
 
-331: "lazy creation of CLOS classes for user-defined conditions"
-    (defstruct foo)
-    (defstruct (bar (:include foo)))
-    (sb-mop:class-direct-subclasses (find-class 'foo))
-  returns NIL, rather than a singleton list containing the BAR class.
-
 332: "fasl stack inconsistency in structure redefinition"
   (reported by Tim Daly Jr sbcl-devel 2004-05-06)
   Even though structure redefinition is undefined by the standard, the
diff --git a/NEWS b/NEWS
index b091151..a86e5ba 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,8 @@
 changes in sbcl-0.8.18 relative to sbcl-0.8.17:
   * new feature: reloading changed shared object files with
     LOAD-SHARED-OBJECT now causes the new definitions to take effect.
+  * fixed bug #331: structure-class instances corresponding to
+    DEFSTRUCT forms are now created eagerly.
 
 changes in sbcl-0.8.17 relative to sbcl-0.8.16:
   * new feature: a build-time option (controlled by the :SB-UNICODE
index 3b87419..ed76500 100644 (file)
          (t
           (error "~@<~S is not the name of a class.~@:>" name)))))
 
-(defun maybe-reinitialize-structure-class (classoid)
+(defun ensure-defstruct-class (classoid)
   (let ((class (classoid-pcl-class classoid)))
-    (when class
-      (ensure-non-standard-class (class-name class) class))))
+    (cond (class
+           (ensure-non-standard-class (class-name class) class))
+          ((eq 'complete *boot-state*) 
+           (ensure-non-standard-class (classoid-name classoid))))))
 
-(pushnew 'maybe-reinitialize-structure-class sb-kernel::*defstruct-hooks*)
+(pushnew 'ensure-defstruct-class sb-kernel::*defstruct-hooks*)
 \f
 (defun make-class-predicate (class name)
   (let* ((gf (ensure-generic-function name :lambda-list '(object)))
index 0cdefc6..c510eb1 100644 (file)
 (defclass tomato () ())
 (assert (null (sb-mop:class-direct-subclasses (find-class 'vegetable))))
 
+;;; bug 331: lazy creation of clos classes for defstructs
+(defstruct bug-331-super)
+(defstruct (bug-331-sub (:include bug-331-super)))
+(let ((subs (sb-mop:class-direct-subclasses (find-class 'bug-331-super))))
+  (assert (= 1 (length subs)))
+  (assert (eq (car subs) (find-class 'bug-331-sub))))
+
 \f
 ;;;; success
 (sb-ext:quit :unix-status 104)
index 4951bfc..ca486d5 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".)
-"0.8.17.1"
+"0.8.17.2"