[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-smalltalk] asString for Floats?
From: |
Stephen Compall |
Subject: |
Re: [Help-smalltalk] asString for Floats? |
Date: |
Thu, 02 Nov 2006 15:32:25 -0600 |
User-agent: |
Thunderbird 1.5.0.7 (Macintosh/20060909) |
J Pfersich wrote:
> For the Character, asString gives me the representation I'm looking for,
> whereas the Float only has printString available. Shouldn't there be
> a asString method available for Floats?
No, and here's why.
st> #($p $o $n $g) asString printNl!
'pong'
st> #($p $o $n $g) printNl!
($p $o $n $g )
In other words, the "printable representation" (what #printOn: puts on
its stream argument) isn't the same as "an equivalent object of class
String" (what #asString answers).
Languages that rely on a single method convert-to-string protocol blur
this important distinction.
--
Stephen Compall
http://scompall.nocandysw.com/blog