1.0.33.5: improve DESCRIBE (#lp488976)
authorGabor Melis <mega@hotpop.com>
Fri, 4 Dec 2009 16:07:38 +0000 (16:07 +0000)
committerGabor Melis <mega@hotpop.com>
Fri, 4 Dec 2009 16:07:38 +0000 (16:07 +0000)
Instead of printing the object type and address in an around method on
DESCRIBE-OBJECT, make it a normal method that all other methods are
supposed to call via CALL-NEXT-METHOD if they wish. This makes it
possible to completely change the output of DESCRIBE for one class
while leaving other classes alone.

Also, kill the unused *IN-DESCRIBE* var in the process.

src/code/describe.lisp
version.lisp-expr

index 7762f8e..1f13b6f 100644 (file)
 
 (defgeneric describe-object (x stream))
 
-(defvar *in-describe* nil)
-
-(defmethod describe-object :around (x s)
-  (cond (*in-describe*
-         (call-next-method))
-        (t
-         (format s "~&~A~%  [~A]~%"
-                 (object-self-string x)
-                 (object-type-string x))
-         (pprint-logical-block (s nil)
-           (call-next-method x s)))))
-
 ;;; Catch-all.
 (defmethod describe-object ((x t) s)
+  (format s "~&~A~%  [~A]~%"
+          (object-self-string x)
+          (object-type-string x))
   (values))
 
 (defmethod describe-object ((x cons) s)
+  (call-next-method)
   (describe-function x nil s))
 
 (defmethod describe-object ((x function) s)
+  (call-next-method)
   (describe-function nil x s))
 
 (defmethod describe-object ((x class) s)
+  (call-next-method)
   (describe-class nil x s)
   (describe-instance x s))
 
 (defmethod describe-object ((x sb-pcl::slot-object) s)
+  (call-next-method)
   (describe-instance x s))
 
 (defmethod describe-object ((x character) s)
+  (call-next-method)
   (format s "~%:_Char-code: ~S" (char-code x))
   (format s "~%:_Char-name: ~A~%_" (char-name x)))
 
 (defmethod describe-object ((x array) s)
+  (call-next-method)
   (format s "~%Element-type: ~S" (array-element-type x))
   (if (vectorp x)
       (if (array-has-fill-pointer-p x)
     (terpri s)))
 
 (defmethod describe-object ((x hash-table) s)
-  ;; Don't print things which are already apparent from the printed representation
-  ;; -- COUNT, TEST, and WEAKNESS
-  (format s "~%Occupancy: ~,1F" (float (/ (hash-table-count x) (hash-table-size x))))
+  (call-next-method)
+  ;; Don't print things which are already apparent from the printed
+  ;; representation -- COUNT, TEST, and WEAKNESS
+  (format s "~%Occupancy: ~,1F" (float (/ (hash-table-count x)
+                                          (hash-table-size x))))
   (format s "~%Rehash-threshold: ~S" (hash-table-rehash-threshold x))
   (format s "~%Rehash-size: ~S" (hash-table-rehash-size x))
   (format s "~%Size: ~S" (hash-table-size x))
   (terpri s))
 
 (defmethod describe-object ((symbol symbol) stream)
+  (call-next-method)
   ;; Describe the value cell.
   (let* ((kind (info :variable :kind symbol))
          (wot (ecase kind
       (terpri stream))))
 
 (defmethod describe-object ((package package) stream)
+  (call-next-method)
   (describe-documentation package t stream)
   (flet ((humanize (list)
            (sort (mapcar (lambda (x)
index e33922f..8a41bfe 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.33.4"
+"1.0.33.5"