1.0.23.35: CLOS tweaking
authorNikodemus Siivola <nikodemus@random-state.net>
Fri, 12 Dec 2008 10:55:34 +0000 (10:55 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Fri, 12 Dec 2008 10:55:34 +0000 (10:55 +0000)
 * Muffle undefined function style-warning for slot-accessors. The
   slot-accessor name is an internal detail, and defining functions
   accessing slots before classes with such slots are defined is fine.

 * Don't double-fetch slot-definition-initfunction in
   SHARED-INITIALIZE (SLOT-OBJECT).

 * Don't double-fetch various slot-definition properties in
   COMPUTE-EFFECTIVE-SLOT-DEFINITION-INITARGS, and declare
   type-check-functions as functions.

NEWS
src/pcl/init.lisp
src/pcl/slots-boot.lisp
src/pcl/std-class.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index 9e95efb..096f1e9 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -18,6 +18,9 @@
   * bug fix: direct superclasses of STANDARD-CLASS and
     FUNCALLABLE-STANDARD-CLASS now default to STANDARD-OBJECT and
     FUNCALLABLE-STANDARD-OBJECT as required by AMOP.
+  * bug fix: compiling a call to SLOT-VALUE with a constant slot-name
+    when no class with the named slot yet exists no longer causes a
+    compile-time style-warning.
 
 changes in sbcl-1.0.23 relative to 1.0.22:
   * enhancement: when disassembling method functions, disassembly
index 4306079..912c197 100644 (file)
          (initialize-slot-from-initfunction (class instance slotd)
            ;; CLHS: If a before method stores something in a slot,
            ;; that slot won't be initialized from its :INITFORM, if any.
-           (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+)
-                 (setf (slot-value-using-class class instance slotd)
-                       (let ((initfn (slot-definition-initfunction slotd)))
-                         (when initfn
-                           (funcall initfn)))))
-               (unless (or (null (slot-definition-initfunction slotd))
-                           (slot-boundp-using-class class instance slotd))
-                 (setf (slot-value-using-class class instance slotd)
-                       (funcall (slot-definition-initfunction slotd)))))))
+           (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+)
+                   (setf (slot-value-using-class class instance slotd)
+                         (when initfun
+                           (funcall initfun))))
+                 (unless (or (not initfun)
+                             (slot-boundp-using-class class instance slotd))
+                  (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)))
+                  collect slotd)))
       (dolist (slotd initfn-slotds)
         (if (eq (slot-definition-allocation slotd) :class)
             (when (or (eq t slot-names)
index b2b1f21..c9fa220 100644 (file)
                       (ensure-accessor 'reader ',reader-name ',slot-name))))
       (declare (ignore .ignore.))
       (truly-the (values t &optional)
-                 (funcall #',reader-name ,object)))))
+                 ;; Don't give a style-warning about undefined function here.
+                 (funcall (locally (declare (muffle-conditions style-warning))
+                            #',reader-name)
+                          ,object)))))
 
 (defmacro accessor-set-slot-value (object slot-name new-value &environment env)
   (aver (constantp slot-name env))
index ab1406f..b07aa0c 100644 (file)
           (setq name (slot-definition-name slotd)
                 namep t))
         (unless initp
-          (when (slot-definition-initfunction slotd)
+          (awhen (slot-definition-initfunction slotd)
             (setq initform (slot-definition-initform slotd)
-                  initfunction (slot-definition-initfunction slotd)
+                  initfunction it
                   initp t)))
         (unless documentationp
-          (when (%slot-definition-documentation slotd)
-            (setq documentation (%slot-definition-documentation slotd)
+          (awhen (%slot-definition-documentation slotd)
+            (setq documentation it
                   documentationp t)))
         (unless allocp
           (setq allocation (slot-definition-allocation slotd)
             (setf type-check-function
                   (if type-check-function
                       (let ((old-function type-check-function))
+                        (declare (function old-function fun))
                         (lambda (value)
                           (funcall old-function value)
                           (funcall fun value)))
index 160131f..7ed970b 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.23.34"
+"1.0.23.35"