[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: print errors in print-object
Heinrich Taube writes:
> If a print-object method signals an error because an unbound slot is
> accessed, CLISP goes into a infinite error printing loop. Shouldn't
> it stop trying to print the object after it signals the first error?
Sure it should, and it did stop printing endless error messages before
we put in the condition system. Here is a patch. Apply it to user1.lsp,
then compile and load user1.lsp and condition.lsp.
*** user1.lsp.bak Sun Sep 10 12:54:52 1995
--- user1.lsp Tue Dec 5 22:28:17 1995
***************
*** 482,488 ****
(progn (write-string "** - Continuable Error" *error-output*) (terpri *error-output*))
(write-string "*** - " *error-output*)
)
! (sys::print-condition condition *error-output*)
(symbol-stream '*debug-io* :io)
(when may-continue
(if continuable
--- 482,502 ----
(progn (write-string "** - Continuable Error" *error-output*) (terpri *error-output*))
(write-string "*** - " *error-output*)
)
! ;; Output the error message, but don't trap into recursive errors.
! (let ((*recursive-error-count* (1+ *recursive-error-count*)))
! (if (> *recursive-error-count* 3)
! (progn
! (setq *recursive-error-count* 0)
! (write-string
! #L{
! DEUTSCH "Unausgebbare Fehlermeldung"
! ENGLISH "Unprintable error message"
! FRANCAIS "Message inimprimable"
! }
! *error-output*
! ) )
! (sys::print-condition condition *error-output*)
! ) )
(symbol-stream '*debug-io* :io)
(when may-continue
(if continuable
The effect is the following behaviour:
> (defclass a () ((b)))
#<STANDARD-CLASS A>
> (defmethod print-object ((a a) s) (print (slot-value a 'b) s))
#<STANDARD-METHOD (#<STANDARD-CLASS A> #<BUILT-IN-CLASS T>)>
> (make-instance 'a)
*** - SLOT-VALUE: The slot B of
*** - SLOT-VALUE: The slot B of
*** - SLOT-VALUE: The slot B of
*** - Unprintable error message
1. Break>
Bruno