Re: [Pharo-users] Transcript: printString or asString

2019-10-15 Thread Richard O'Keefe
It may be worth noting that the 1998 ANSI Smalltalk standard defines #asString for Character, , 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 local

Re: [Pharo-users] Transcript: printString or asString

2019-10-15 Thread Samuel Teixeira Santos
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 re

Re: [Pharo-users] Transcript: printString or asString

2019-10-14 Thread Richard Sargent
Samuel, One thing I don't recall seeing in this thread is a discussion of the semantics of the methods names. I find it helpful to consider #asWhatever to be a conversion method, used to convert one object to another essentially compatible class. e.g. #asFloat sent to an integer would be expected

Re: [Pharo-users] Transcript: printString or asString

2019-10-14 Thread Samuel Teixeira Santos
Very clear to me now. Thank you and to others too by your previous answers

Re: [Pharo-users] Transcript: printString or asString

2019-10-14 Thread Christopher Fuhrman
On Mon, Oct 14, 2019, 08:49 Samuel Teixeira Santos wrote: > when you say when: "what this object converted *to a string means in my > domain"* - what really means, specially about when you say *'domain'?* > > Could you give some example for this? > > Thanks > A good example might be PLU codes [1

Re: [Pharo-users] Transcript: printString or asString

2019-10-14 Thread Samuel Teixeira Santos
I like the way you put because it's a nice way to remember and to teach too. I'm just bit confusing, and I think this because Object Oriented it's not one of my strong skills, when you say when: "what this object converted *to a string means in my domain"* - what really means, specially about when

Re: [Pharo-users] Transcript: printString or asString

2019-10-14 Thread Sean P. DeNigris
arcanosam wrote > printString... v asString... There is something different about both? I will add that conceptually: - #printString = what a developer would want to see, e.g. in an inspector - #displayString = a string suitable for UI (i.e. in production) - #asString - while typically implemented

Re: [Pharo-users] Transcript: printString or asString

2019-10-14 Thread Samuel Teixeira Santos
Thank you too Richard. Very interesting and elucidative. Regards to all.

Re: [Pharo-users] Transcript: printString or asString

2019-10-14 Thread Richard O'Keefe
days keysAndValuesDo: [:key :value | Transcript print: key; nextPutAll: ' has '; print: value; nextPutAll: ' days'; cr]. Transcript endEntry. works too and in some Smalltalks is easily the most efficient approach, as it does not construct any strings you have no other use for. In Pharo, howeve

Re: [Pharo-users] Transcript: printString or asString

2019-10-13 Thread Samuel Teixeira Santos
Hi Tim. I just learned in previous videos of the mooc about using nautilus to explore using "Implementers of..." or "Senders of..." I will do that for sure now. Thanks for your tip. Regards >

Re: [Pharo-users] Transcript: printString or asString

2019-10-13 Thread Tim Mackinnon
Hi - While I’m sure everyone can give you an answer - it’s more useful to teach you how to answer these questions for your self. Try right clicking with your cursor on asString and choose “implementors of” (it may have a slightly different name friending on Pharo version - or press “meta”-m.