Hi Torsten, On Sun, Oct 22, 2017 at 10:40:41AM +0200, Torsten Bergmann wrote:
Alistair Grant wrote:
I can't comment on the original thinking behind this
The original thinking is simple and as the name says: you want to print the object (even when it is a string) to be print in a string.
So it always is a "printObjectInString" instead of a "printObjectAsString" behavior. Also the resulting string often is a string to easily reconstruct the object.
So it is not a conversion method. There is #asString for that.
Hmm, I knew about #asString, but this was a while ago, so I can't remember why I didn't use it. But thanks for the reminder.
If we're displaying values such as numbers and strings in a UI, e.g. table, we normally don't want the strings always enclosed in quotes.
There is #displayString for this task (which may return the printString or is overwritten) and this is common in nearly all Smalltalks I know.
Right, so what would be nice is for UI elements / GT toolkit to move to using #displayString by default, and to add String>>displayString that answers the receiver (currently in Pharo String uses the default #printString, which returns the string with quotes).
From memory this has been discussed before, but I couldn't find it, and don't remember the outcome.
Thanks, Alistair