Subject: print errors in print-object

From: Heinrich Taube <[email-masked]>
Date: Tue, 5 Dec 95 07:25:50 -0600

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?

---------
> (use-package :clos)
T
> (defclass a () ((b)))
#<STANDARD-CLASS A>
> (defmethod print-object ((a a) s) (print (slot-value a 'b) s))

WARNING:
The generic function #<GENERIC-FUNCTION PRINT-OBJECT> is being modified, but has already  
been called.
#<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 

*** - SLOT-VALUE: The slot B of 

*** - SLOT-VALUE: The slot B of 

*** - SLOT-VALUE: The slot B of 

*** - SLOT-VALUE: The slot B of 

*** - SLOT-VALUE: The slot B of

---

From: [email-masked] (Bruno Haible)
Date: Tue, 5 Dec 95 22:39:47 +0100

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

#<STANDARD-CLASS 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