[ENH] Object>>asStringOrText

Diego Gomez Deck DiegoGomezDeck at ConsultAr.com
Sat Oct 11 15:49:26 UTC 2003


Hi Stef...

> Hi diego
> 
> I do not have the time to look carefully, but is it the equivalent of 
> the displayString in VisualWorks?
> In VW you have printString for "looking at the object in the debugger, 
> inspector" and displayString to get a
> string when the object is displayed in list.

I'm not the expert here so what I'll say is pure-guessing based on my
understanding.

> What is the difference between asStringOrtext and printString? If this 
> is the VW displayString intention maybe we should
> call it in a similar way to convey its precise intent and fix the 
> widgets.

In Squeak we have not #displayString, we have #printString (and related
like #fullPrintString, #printStringLimitedTo:, etc) and #asString.

#asString is only a conversion message (not a printing one), to see to
see the difference evaluate:

   'Squeak' printString.
   'Squeak' asString.

The message in question (#asStringOrText) is a conversion method but
take care of the 'OrText' part.  The receiver can choose to answer a
plain String or a Text (a String with formatting).

In the current version of Squeak you can find this message implemented
in: String and Text (with ^ self) and in MethodReference (I guess, the
only user of this idiom).

My [ENH] just generalizes this idiom in Object.

> Stef

I hope this helps.

Cheers,

Diego

PS: How the French translation is progressing?




More information about the Squeak-dev mailing list