restarts for PRINT-NOT-READABLE errors
[sbcl.git] / src / code / target-random.lisp
index 2f7d1a6..d4c98c3 100644 (file)
 
 (def!method print-object ((state random-state) stream)
   (if (and *print-readably* (not *read-eval*))
-      (error 'print-not-readable :object state)
+      (restart-case
+          (error 'print-not-readable :object state)
+        (print-unreadably ()
+          :report "Print unreadably."
+          (write state :stream stream :readably nil))
+        (use-value (object)
+          :report "Supply an object to be printed instead."
+          :interactive read-unreadable-replacement
+          (write object :stream stream)))
       (format stream "#S(~S ~S #.~S)"
               'random-state
               ':state