It may be worth noting that the 1998 ANSI Smalltalk standard defines
#asString for
Character, <readableString>, String, and Symbol and for those classes only.
VisualWorks extends #asString to things like Filename and URIs and Text and
several other things for which "convert to String" makes sense and are not
locale-dependent.  VW does *not* extend #asString to Object.
Visual Age Smalltalk *does* define Object>>asString ^self printString
but overrides this so that nil asString => ''.
Put it this way: if you use #asString for anything that is not some
kind of text or
some kind of 'locator' having an externally defined representation which can
be converted back to an equal 'locator' (file name, URI, network host name,
X11 font, ISO country currency or language code), don't expect your code to
be even close to portable.

On Wed, 16 Oct 2019 at 00:13, Samuel Teixeira Santos
<arcano...@gmail.com> wrote:
>
> Hi Richard.
>
> Very useful your considerations. I find too the messages like #asWhatever, 
> like you said, were about type conversions, similar like we have in other 
> languages.
>
> #printString and the others remember me the special method in Python __str__ 
> or __unicode__ which allow change the default representation of object you 
> dealing of.
>
> Thank you, I will pay attention when dealing with this messages

Reply via email to