printString is a template method
printOn: a hook
so you should specialize printOn:

On Jun 25, 2011, at 6:07 AM, Alan Rodas wrote:

> Hello folks
> 
> I was wondering why does Smalltlak prefer the printOn: aStream method over 
> the printString method.
> 
> As I work with Java and C# all the time, I'm used to define a printString 
> like method where you return a string representing the object,
> and, today, having to do the same in smalltlak I unconsciously redefined the 
> printString method. As soon as I realize that my collections were using 
> printOn: instead of my redefined printSrting method for printing their 
> contents, I wondered:
> 
> Why was this decision taken? I mean, every other language seems more simple 
> (from the end user point of view, as it does not require the user to 
> understand streams at all), In the other hand, printOn: seems more versatile.
> 
> Pointless question, I know, but I'm quite curious and I cannot seem to find 
> anything about this, and I though that you guys may know.
> 
> Cheers
> -- 
> Alan Rodas Bonjour
> 


Reply via email to