[Newbies] concatenation of non-Collections

Mark Volkmann 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

instead of

	msg := 'The number is ', number printString

Or even this:

	msg := number, ' is the value you entered.'

instead of

	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.

Mark Volkmann

More information about the Beginners mailing list