From: Barry Margolin
Subject: Re: Strange behavior with print-object
Date: 
Message-ID: <LEKj9.8$Wn3.2626@paloalto-snr1.gtei.net>
In article <··············@slave.local.>,
Andrew Hyatt  <···········@remove.this.thehyatts.net> wrote:
>[14]> (defmethod print-object ((self testclass) stream) (print
>(get-value self) stream)) 
>#<STANDARD-METHOD (#<STANDARD-CLASS TESTCLASS> #<BUILT-IN-CLASS T>)> 
>[15]> (print a)
>
>"foo"  
>
>"foo" 
>
>Now you see the problem:
>
>[16]> (princ-to-string a)
>"
>\"foo\" "
>
>And just to make sure it is something wrong with print-object:
>
>[17]> (princ-to-string (get-value a))
>"foo"
>
>Where did these extra quotes come from?  How can I get rid of them?

The outer quotes are because you're printing into a string, and strings are
printed with quotes around them.  The inner quotes are from the printed
representation of the object itself, just as is shown when you do (print
a).

If you want it to behave differently depending on whether you use
PRINT-TO-STRING or PRINC-TO-STRING, it needs to look at *PRINT-ESCAPE*.  Or
it can use WRITE instead of PRINT, which will automatically interpret all
the *PRINT-xxx* variables properly.

-- 
Barry Margolin, ······@genuity.net
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.