[mcclim-devel] DESCRIBE-OBJECT methods

rpgoldman at real-time.com rpgoldman at real-time.com
Wed Jun 1 19:06:20 UTC 2005


One thing that's made the built-in describe less useful for me than it
might be is that it seems to bottom out at CONSes.  So if I have data
structures that contain a CONS (e.g., a list-valued slot), I get
tantalizingly close to seeing what I want to see, but then can't drill
down any further.  [I suppose I could try invoking Clouseau...]

I believe it would be relatively straightforward to add a new
describe-object method that would look at the contents of a CONS, but
I'm concerned that this might be risky in the case of objects that are
very large.  PPRINT, of course, gets around this by using
*print-length*, and I suppose I could also, but that seems like an
abuse of a built in.  For lack of a better, here's what I came up with
(inserted into DESCRIBE.LISP):

(defmethod describe-object ((thing list) stream)
  (format stream "~S is a list~%" thing)
  (loop for x in thing
      for i from 0
      until (and *print-length* (= i *print-length*))
      do (describe-object x stream)
	 (terpri stream)
      finally (when (< (1+ i) (length thing))
		(format stream "...~%"))))

I don't think that the above is really right, but perhaps it's a step
in the right direction?  Can anyone refine it?

Also, when I was editing describe.lisp, it confused my emacs interface
a bunch, because the mode line lists specifies COMMON-LISP as the
package, but the in-package form says CLIM-LISP.  The Allegro
Emacs-lisp interface ignores the latter in favor of the former!

Best,
R



More information about the mcclim-devel mailing list