[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: no describe?



At 11:39 AM 4/13/95, Ken Tilton wrote:
>Following Keene, I attempted to define a "describe" method for my class. I
>see from the error that "describe" is not a generic function. Is there some
>other method I override to achieve the same end:controlling the appearance
>of raw object descriptions?

The generic function you can specialize is called describe-object.
describe is a regular function that calls describe-object.

? (defclass frob ()())
#<STANDARD-CLASS FROB>
? (defmethod describe-object ((frob frob) stream)
    (format stream "~s is a frob." frob))
#<STANDARD-METHOD DESCRIBE-OBJECT (FROB T)>
? (describe (make-instance 'frob))
#<FROB #x1C3F039> is a frob.
?