[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-smalltalk] asString for Floats?
From: |
Michael Fellinger |
Subject: |
Re: [Help-smalltalk] asString for Floats? |
Date: |
Mon, 6 Nov 2006 12:12:24 +0900 |
User-agent: |
KMail/1.9.5 |
On Friday 03 November 2006 06:32, Stephen Compall wrote:
> 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.
My brain very much appreciates blurring such things, as it helps concentrating
on the problem, not the implementation ;)
^manveru