From: James Edward Gray II Date: 2005-07-27T00:26:10+09:00 Subject: Re: defining to_s works oddly? On Jul 26, 2005, at 10:18 AM, Jacob Fugal wrote: > On 7/26/05, James Edward Gray II wrote: > >> For that, you need the duck typed version of the method, to_str()... >> > > I'm curious about that... why the two methods, to_s/to_str? I know > it's been discussed before, and I *think* I understood it then, but > I've since forgotten and there are probably others who haven't heard > the explanation before. Why discusses that a little at: http://whytheluckystiff.net/articles/rubyOneEightOh.html Here's probably the most relevant quote: "So why not use to_s? Because to_s coerces objects into strings. So, to_str is an implicit cast, whereas to_s is an explicit cast." Hope that helps. James Edward Gray II