From: Rasputin Date: 2003-05-31T01:06:49+09:00 Subject: Re: to_s and concatenation * ts [030530 14:52]: > >>>>> "R" == Rasputin writes: > > R> irb(main):010:0> puts "foo" + Wtf.new > R> TypeError: failed to convert Wtf into String > > String#+ want an object which respond to #to_str Right, but when do you use one and when the other? Pickaxe says: to_str str.to_str -> str Synonym for String#to_s . to_str is used by methods such as String#concat to convert their arguments to a string. Unlike to_s, which is supported by almost all classes, to_str is normally implemented only by those classes that act like strings. Of the built-in classes, only Exception and String implement to_str. supports what you just said (although the 'synonym for' sentence is a bit misleading), but what else would you use to_s for but to print to stdout? I know this is probably basic stuff, but there doesn't seem to be anywhere else to ask... -- Rasputin :: Jack of All Trades - Master of Nuns