Michael Fellinger wrote: >> st> #($p $o $n $g) asString printNl! >> 'pong' >> st> #($p $o $n $g) printNl! >> ($p $o $n $g ) >> >> Languages that rely on a single method convert-to-string protocol blur >> this important distinction. > > My brain very much appreciates blurring such things, as it helps > concentrating > on the problem, not the implementation ;)
If it helps, #printString is the universal protocol (applicable to all objects), whereas #asString is specific to a few objects that have equivalent representations as strings. I think Java's toString() was supposed to offer similar functionality as the #printOn: protocol; they just forgot that when writing some of the methods. This is too bad. -- Stephen Compall http://scompall.nocandysw.com/blog ##smalltalk,#gnu-smalltalk on Freenode IRC _______________________________________________ help-smalltalk mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-smalltalk
