restarts for PRINT-NOT-READABLE errors
[sbcl.git] / src / code / pprint.lisp
index c0ab247..c8e2301 100644 (file)
@@ -1009,8 +1009,16 @@ line break."
          (output-ugly-object array stream))
         ((and *print-readably*
               (not (array-readably-printable-p array)))
-         (let ((*print-readably* nil))
-           (error 'print-not-readable :object array)))
+         (restart-case
+             (error 'print-not-readable :object array)
+           (print-unreadably ()
+             :report "Print unreadably."
+             (let ((*print-readably* nil))
+               (pprint-array stream array)))
+           (use-value (o)
+             :report "Supply an object to be printed instead."
+             :interactive read-unreadable-replacement
+             (write o :stream stream))))
         ((vectorp array)
          (pprint-vector stream array))
         (t