Re: Why do we persist in using "Transcript show:"? That hardly seems OO!
"Troy Brumley" <[hidden email]> wrote in message
> My first Smalltalk was ObjectStudio, and it has some neat ease of use
> features. One I like and find very intuitive is Object>>out.
> Instead of "Transcript show: anObject printString; cr." I can say
> A first implementation, which needs to be overridden for String to remove
> single quotes, is:
> "Display self upon Transcript in a reasonable format."
> Transcript show: self printString; cr.
> I've watched some very bright people continue to type these long
> show:" commands ... why do we stay trapped in old patterns? Are there
> things we do routinely that could be done better and lessen the confusion
> new Smalltalkers?
> Troy Brumley
> Lead Software Engineer, Smalltalk
> Cincom Systems, Inc.
QKS Smalltalk (and now SmallScript) has used #<< and #>> for a long time.
They are designed and implemented to parallel the functionality one finds in
C++ for the equivalent operators.
The given object can then be supplied with a pattern and using OO it will
then in turn be sent a string output formatting message that includes the
stream so that it can then emit itself onto the stream as appropriate. A
default implementation of the string formatting operation in Object will
obtain the string form and place it on the stream. This approach can also
be used to unify operations such as addAll:, our #add:, and can be
effectively applied to any target (i.e., it is useful for collections).
There are other habit based Smalltalk patterns that might be considered
anachronistic as well (and could be candidates for consideration as
Not every Smalltalker stays trapped in patterns (some Smalltalks didn't even
start with the same patterns). But as I'm probably considered to be a
Smalltalk radical/revolutionary who am I to say ;-).
-- Dave Simmons [www.qks.com / www.smallscript.com]
"Effectively solving a problem begins with how you express it."