0.9.13.32: restarts for slot-unbound
authorNikodemus Siivola <nikodemus@random-state.net>
Wed, 7 Jun 2006 09:58:37 +0000 (09:58 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Wed, 7 Jun 2006 09:58:37 +0000 (09:58 +0000)
 * USE-VALUE and STORE-VALUE have obvious meanings here, so use them.
 * Missing NEWS for .31.

NEWS
package-data-list.lisp-expr
src/pcl/slots.lisp
tests/clos.impure.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index 4a3386d..b688654 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -4,12 +4,16 @@ changes in sbcl-0.9.14 relative to sbcl-0.9.13:
     on OS X/x86.
   * feature: SBCL now tries to signal a STORAGE-CONDITION when running out
     of heap.
+  * feature: SBCL now provides USE-VALUE and STORE-VALUE restarts in the
+    default method for SLOT-UNBOUND.
   * minor incompatible change: prevent the user from specializing the
     new-value argument to SB-MOP:SLOT-VALUE-USING-CLASS.  It's
     somewhat counter to the intent of the protocol, I (CSR) think, and
     additionally it just doesn't work in SBCL as currently
     implemented, thanks to optimizations (that are always valid for
     the other three SLOT-VALUEish functions, but not for the setter).
+  * bug fix: native unparsing of pathnames with :DIRECTORY NIL failed
+    with a type error. (reported by blitz_ on #lisp)
   * bug fix: unparsing logical pathnames with :NAME :WILD :TYPE NIL
     failed with a type error.  (reported by Pascal Bourguignon)
   * bug fix: merging pathnames against defaults with :DIRECTORY
index e92df2a..075589c 100644 (file)
@@ -889,6 +889,7 @@ retained, possibly temporariliy, because it might be used internally."
                "NTH-BUT-WITH-SANE-ARG-ORDER"
                "DEPRECATION-WARNING"
                "BIT-VECTOR-="
+               "READ-EVALUATED-FORM"
 
                ;; ..and macros..
                "COLLECT"
index 2e3d358..a37f983 100644 (file)
          instance))
 
 (defmethod slot-unbound ((class t) instance slot-name)
-  (error 'unbound-slot :name slot-name :instance instance))
+  (restart-case
+      (error 'unbound-slot :name slot-name :instance instance)
+    (use-value (v)
+      :report "Return a value as the slot-value."
+      :interactive read-evaluated-form
+      v)
+    (store-value (v)
+      :report "Store and return a value as the slot-value."
+      :interactive read-evaluated-form
+      (setf (slot-value instance slot-name) v))))
 
 (defun slot-unbound-internal (instance position)
   (values
index c415f1a..d04a4c0 100644 (file)
                                         (list (find-class 'integer))))))
 (assert (= (remove-method-1 3) 4))
 (assert (= (remove-method-2 3) 2))
+
+;;; ANSI doesn't require these restarts, but now that we have them we
+;;; better test them too.
+(defclass slot-unbound-restart-test () ((x)))
+(let ((test (make-instance 'slot-unbound-restart-test)))
+  (assert (not (slot-boundp test 'x)))
+  (assert (= 42 (handler-bind ((unbound-slot (lambda (c) (use-value 42 c))))
+                  (slot-value test 'x))))
+  (assert (not (slot-boundp test 'x)))
+  (assert (= 13 (handler-bind ((unbound-slot (lambda (c) (store-value 13 c))))
+                  (slot-value test 'x))))
+  (assert (= 13 (slot-value test 'x))))
+
 \f
 ;;;; success
index 1091375..e7667ef 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.9.13.31"
+"0.9.13.32"