From: Jeff
Subject: A different string descriptor
Date: 
Message-ID: <cft75e$qam@odah37.prod.google.com>
Is there a method of returning a different string descriptor for a
class? I've been searching though ANSI Common Lisp (PG's book) and
can't seem to find anything like I want. For example:

(defclass point ()
((x :initform 0.0)
(y :initform 0.0)))

(defclass circle ()
((center :initform (make-instance 'point))
(radius :initform 10.0)))

Now I'd like to have a way of each of these returning a different
string whenever needed (by format for example) without needing
accessors in the class. So, if at the prompt I type:

CL-USER 1 > (make-instance 'circle)
==> #< CIRCLE >

Instead, I'd like it to do:

CL-USER 2 > (make-instance 'circle)
==> "Circle @ (0,0) with radius 10"

In the end, I wouldn't mind using accessors and creating a method to do
this, but it would make my life a whole lot simpler if this were
possible. Thanks in advance for all welcome replies :)

Jeff
From: Peter Seibel
Subject: Re: A different string descriptor
Date: 
Message-ID: <m33c2l245n.fsf@javamonkey.com>
"Jeff" <···@insightbb.com> writes:

> Is there a method of returning a different string descriptor for a
> class? I've been searching though ANSI Common Lisp (PG's book) and
> can't seem to find anything like I want. For example:

See PRINT-OBJECT and PRINT-UNREADABLE-OBJECT.

-Peter

-- 
Peter Seibel                                      ·····@javamonkey.com

         Lisp is the red pill. -- John Fraser, comp.lang.lisp