(fmakunbound 'print-object)
(defgeneric print-object (object stream))
(defmethod print-object ((x t) stream)
- (print-unreadable-object (x stream :type t :identity t))))
+ (if *print-pretty*
+ (pprint-logical-block (stream nil)
+ (print-unreadable-object (x stream :type t :identity t)))
+ (print-unreadable-object (x stream :type t :identity t)))))
(/show0 "done replacing placeholder PRINT-OBJECT with DEFGENERIC")
\f
;;;; a hook called by the printer to take care of dispatching to PRINT-OBJECT
(defun named-object-print-function (instance stream
&optional (extra nil extra-p))
- (print-unreadable-object (instance stream :type t)
- (if extra-p
- (format stream
- "~S ~:S"
- (slot-value-or-default instance 'name)
- extra)
- (format stream
- "~S"
- (slot-value-or-default instance 'name)))))
+ (let ((name (slot-value-or-default instance 'name)))
+ (print-unreadable-object (instance stream :type t :identity (not name))
+ (if extra-p
+ (format stream "~S ~:S" name extra)
+ (format stream "~S" name)))))
(defmethod print-object ((class class) stream)
(named-object-print-function class stream))
(multiple-value-bind (lines-used lines-total max-depth depth-limit)
(cache-statistics cache)
(format stream
- "~D key, ~P~:[no value~;value~], ~D/~D lines, depth ~D/~D"
+ "~D key~P, ~:[no value~;value~], ~D/~D lines, depth ~D/~D"
(cache-key-count cache)
(cache-key-count cache)
(cache-value cache)
(defmethod print-object ((dfun-info dfun-info) stream)
(declare (type stream stream))
(print-unreadable-object (dfun-info stream :type t :identity t)))
+
+(defmethod print-object ((ctor ctor) stream)
+ (print-unreadable-object (ctor stream :type t)
+ (format stream "~S ~:S" (ctor-class-or-name ctor) (ctor-initargs ctor)))
+ ctor)