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

Re: Printing objects created by make-instance



The command is called PRINT :-)
The default printing method for your classes of objects gives text not suitable
for READ. To customize the printing of your objects, define a method for
PRINT-OBJECT.
(defclass foo () ((x :initarg :x :accessor foo-x)))

(defmethod print-object ((u foo) stream)
  (format stream "#.(make-instance 'foo :x '~S)" (foo-x u)))

I haven't tested this code, and it is probably unsuitable for your needs, but
it could give you ideas.
     Daniel Ranson (ranson@lannion.cnet.fr)