[Openmcl-devel] describe

Paul plathrop at uplinux.net
Thu Jul 3 21:22:07 PDT 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On Thursday, July 3, 2003, at 11:58  PM, Gary Byers wrote:
> DESCRIBE is a non-generic function; it takes one required argument
> (the thing to be described) and an optional argument used to designate
> an output stream.  DESCRIBE basically maps any "stream designators" (T
> or NIL) in its STREAM argument to a real stream, calls DESCRIBE-OBJECT,
> and returns 0 values.
>
> DESCRIBE-OBJECT is a generic function; one typically defines methods
> that specialize on DESCRIBE-OBJECT's first argument, in order to
> influence DESCRIBE's behavior.
>
> For instance:
>
> (defclass rgb-color ()
>   ((red :initarg :red :accessor rgb-color-red)
>    (green :initarg :green :accessor rgb-color-green)
>    (blue :initarg :blue :accessor rgb-color-blue)))
>
>
> (defmethod describe-object ((r rgb-color) stream)
>   (format stream "~&~s is a ~s.  Its red component is ~s, its green 
> component is ~s, and its blue component is ~s"
>    r (class-name (class-of r)) (rgb-color-red r) (rgb-color-green r) 
> (rgb-color-blue r)))
>
>
> This is how things are defined in the spec and in OpenMCL; your CLOS 
> book
> is mistaken (or, more likely, outdated) if it suggests otherwise.  In
> 1988, the X3J13 committee (the committee responsible for developing the
> ANSI CL standard) incorporated CLOS into the language and the original
> CLOS definition (re-)defined DESCRIBE as a generic function.  The CLOS
> definition of DESCRIBE had some shortcomings which X3J13 attempted to
> rectify by introducing the generic function DESCRIBE-OBJECT and making
> DESCRIBE be non-generic again (and adding an optional STREAM argument
> to DESCRIBE).  This happened in early 1989; if the book you're using
> was published in that time frame, it may have missed that change to the
> language.  (Sonya Keene's CLOS book was published in 1989 and is 
> generally
> very good.)

Thank you very much for that clarification. I had trouble interpreting 
the relevant section of the Hyperspec. Interestingly enough the CLOS 
book I am using is Sonya Keene's - I didn't have it handy when I asked 
the question or I would have specified the title. In any case I 
appreciate the answer.

Paul D. Lathrop
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (Darwin)

iEYEARECAAYFAj8FAPMACgkQ634kJSx/Y7H2QQCdGL9FUQRDGzrKS+LBCi89c74X
wskAnigN+w9LJQKdWKULVzqjLVqzyQpD
=HN2O
-----END PGP SIGNATURE-----


_______________________________________________
Openmcl-devel mailing list
Openmcl-devel at clozure.com
http://clozure.com/cgi-bin/mailman/listinfo/openmcl-devel



More information about the Openmcl-devel mailing list