0.pre8.115:
authorChristophe Rhodes <csr21@cam.ac.uk>
Mon, 28 Apr 2003 11:00:22 +0000 (11:00 +0000)
committerChristophe Rhodes <csr21@cam.ac.uk>
Mon, 28 Apr 2003 11:00:22 +0000 (11:00 +0000)
Fix for SLOT-VALUE inside (SETF SLOT-VALUE-USING-CLASS), from
Gerd Moellmann (test case a simplified version of KMR's
hyperobject)
... don't pass a NIL wrapper to the relevant PCL functions
... one or two code cleanups and comments

src/pcl/methods.lisp
src/pcl/std-class.lisp
version.lisp-expr

index 06e0260..8d0f176 100644 (file)
                           *standard-method-combination*))
              type)))))
 
+
+;;; CMUCL (Gerd's PCL, 2002-04-25) comment:
+;;;
+;;; Return two values.  First value is a function to be stored in
+;;; effective slot definition SLOTD for reading it with
+;;; SLOT-VALUE-USING-CLASS, setting it with (SETF
+;;; SLOT-VALUE-USING-CLASS) or testing it with
+;;; SLOT-BOUNDP-USING-CLASS.  GF is one of these generic functions,
+;;; TYPE is one of the symbols READER, WRITER, BOUNDP.  CLASS is
+;;; SLOTD's class.
+;;;
+;;; Second value is true if the function returned is one of the
+;;; optimized standard functions for the purpose, which are used
+;;; when only standard methods are applicable.
+;;;
+;;; FIXME: Change all these wacky function names to something sane.
 (defun get-accessor-method-function (gf type class slotd)
   (let* ((std-method (standard-svuc-method type))
         (str-method (structure-svuc-method type))
     (values
      (if std-p
         (get-optimized-std-accessor-method-function class slotd type)
-        (get-accessor-from-svuc-method-function
-         class slotd
-         (get-secondary-dispatch-function
-          gf methods types
-          `((,(car (or (member std-method methods)
-                       (member str-method methods)
-                       (error "error in get-accessor-method-function")))
-             ,(get-optimized-std-slot-value-using-class-method-function
-               class slotd type)))
-          (unless (and (eq type 'writer)
-                       (dolist (method methods t)
-                         (unless (eq (car (method-specializers method))
-                                     *the-class-t*)
-                           (return nil))))
-            (let ((wrappers (list (wrapper-of class)
-                                  (class-wrapper class)
-                                  (wrapper-of slotd))))
-              (if (eq type 'writer)
-                  (cons (class-wrapper *the-class-t*) wrappers)
-                  wrappers))))
-         type))
+        (let* ((optimized-std-fun
+                (get-optimized-std-slot-value-using-class-method-function
+                 class slotd type))
+               (method-alist
+                `((,(car (or (member std-method methods)
+                             (member str-method methods)
+                             (bug "error in ~S"
+                                  'get-accessor-method-function)))
+                   ,optimized-std-fun)))
+               (wrappers
+                (let ((wrappers (list (wrapper-of class)
+                                      (class-wrapper class)
+                                      (wrapper-of slotd))))
+                  (if (eq type 'writer)
+                      (cons (class-wrapper *the-class-t*) wrappers)
+                      wrappers)))
+               (sdfun (get-secondary-dispatch-function 
+                       gf methods types method-alist wrappers)))
+          (get-accessor-from-svuc-method-function class slotd sdfun type)))
      std-p)))
 
 ;;; used by OPTIMIZE-SLOT-VALUE-BY-CLASS-P (vector.lisp)
index 76b3343..2f88079 100644 (file)
        (compute-slot-accessor-info slotd type gf)))
     (initialize-internal-slot-gfs name)))
 
+;;; CMUCL (Gerd PCL 2003-04-25) comment:
+;;;
+;;; Compute an effective method for SLOT-VALUE-USING-CLASS, (SETF
+;;; SLOT-VALUE-USING-CLASS) or SLOT-BOUNDP-USING-CLASS for reading/
+;;; writing/testing effective slot SLOTD.
+;;;
+;;; TYPE is one of the symbols READER, WRITER or BOUNDP, depending on
+;;; GF.  Store the effective method in the effective slot definition
+;;; object itself; these GFs have special dispatch functions calling
+;;; effective methods directly retrieved from effective slot
+;;; definition objects, as an optimization.
+;;;
+;;; FIXME: Change the function name to COMPUTE-SVUC-SLOTD-FUNCTION,
+;;; or some such.
 (defmethod compute-slot-accessor-info ((slotd effective-slot-definition)
                                       type gf)
   (let* ((name (slot-value slotd 'name))
   (setf (plist-value class 'default-initargs) inits))
 \f
 (defmethod compute-default-initargs ((class slot-class))
-  (let ((cpl (class-precedence-list class))
-       (direct (class-direct-default-initargs class)))
-    (labels ((walk (tail)
-              (if (null tail)
-                  nil
-                  (let ((c (pop tail)))
-                    (append (if (eq c class)
-                                direct
-                                (class-direct-default-initargs c))
-                            (walk tail))))))
-      (let ((initargs (walk cpl)))
-       (delete-duplicates initargs :test #'eq :key #'car :from-end t)))))
+  (let ((initargs (loop for c in (class-precedence-list class)
+                       append (class-direct-default-initargs c))))
+    (delete-duplicates initargs :test #'eq :key #'car :from-end t)))
 \f
 ;;;; protocols for constructing direct and effective slot definitions
 
index 6653b46..52a08f4 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.pre8.114"
+"0.pre8.115"