[Newbies] concatenation of non-Collections
mark at ociweb.com
Sun Nov 2 20:34:42 UTC 2008
Wouldn't it be convenient if you could do this:
msg := 'The number is ', number
msg := 'The number is ', number printString
Or even this:
msg := number, ' is the value you entered.'
msg := number printString, ' is the value you entered.'
This would require the comma method in Collection to act differently
when the argument isn't a Collection
and the Number class would need to add a comma method.
I'm pretty new at this, so maybe there are reasons this is done. Are
As some might guess, I'm used to the way Java automatically calls
toString on things that aren't strings when one side of a
concatenation is a String and the other isn't.
More information about the Beginners