I liked this distinction between printString and displayString.
It was removed probably because it was a mess :)
Stef
> In my experience with Pharo and other Smalltalks as well:
>
> #printString is used for debugging, that's why the default
> implementation shows the class name. It's implemented using #printOn:
>
> #displayString (deprecated in Pharo*) is used to display the object in
> the UI. It is implemented by means of #displayOn: (Dolphin used this
> pattern)
>
> #asString is the toString() equivalent of other languages. In some
> cases `anObject asString asObject` should give the same object back
> (e.g. in Date, Numbers, etc.). Most of the times it is the same string
> as #printString, but it is not consistent.
>
>
> Ej:
> If you have aPerson:
> aPerson printString -> "aPerson ('John Doe')"
> aPerson displayString -> 'John Doe'
>
> Regards,
>
>
> (*) Why #displayString was deprecated?
> Esteban A. Maringolo
>
>
> 2014/1/3 Frank Shearar <[email protected]>:
>> On 3 January 2014 11:44, Otto Behrens <[email protected]> wrote:
>>>> 'Conversion' implies using the resulting String in some further
>>>> computation. 'Printing' usually implies displaying something to the
>>>> user (and nothing more), or serialising to a file/network.
>>>
>>> What kinds of computation are you thinking of regarding a string? I
>>> think I understand what you're saying, I'm just trying to make it a
>>> bit more concrete in my mind.
>>
>> I just mean that sometimes you want to work with a string
>> representation of a thing, and #asString is how you get it. For
>> instance, a Symbol might printString as '#foo' while in its converted
>> form it returns 'foo'.
>>
>>> The requirements of displaying something to the user and serialising
>>> to a file/network are quite different, or not?
>>
>> You're right. I'm wrong in saying that #printString should be used to
>> serialise anything. Actually, you'd probably use #storeString for
>> serialising, if you weren't using Fuel.
>>
>> frank
>>
>