From: Rasputin Date: 2003-05-31T10:16:20+09:00 Subject: Re: to_s and concatenation * Brian Candler [030530 22:34]: > On Sat, May 31, 2003 at 06:13:36AM +0900, Anders Borch wrote: > > hmm... it seems to me that the real question is this: why have both to_s > > and to_str when the return value of them should at all concievable (to > > me at least) times be the same? Exactly, but I think Brians explanation makes sense to me now. I wasa thrown by to_s/to_str in String being synonymous, whereas that's not the case in general. Thanks for the help. > So I believe that to_s is for cases where you explicitly require a > conversion to be made, such as foo.to_s or "#{foo}" > > On the other hand, to_str is for cases where an implicit, automatic > conversion should take place. If you don't define it, then such automatic > conversions do not take place, so you get an exception instead. -- Rasputin :: Jack of All Trades - Master of Nuns