From: James Edward Gray II Date: 2011-01-12T03:17:01+09:00 Subject: [ruby-core:34375] Re: [Ruby 1.9-Feature#4264][Open] General type coercion protocol for Ruby On Jan 11, 2011, at 11:14 AM, Charles Oliver Nutter wrote: > On Tue, Jan 11, 2011 at 10:27 AM, Jim Weirich wrote: >> (1a) Do we need a general solution for the to_a/to_s situation too? > > Maybe? The big problem with to_ary/to_str versus to_a/to_s is that > there's no clear understanding of the differences. > I guess I see the difference being that to_ary/to_str are like > slightly softer type-casting operations and to_a/to_s are hard, > unconditional conversions. I understood it as to_a/to_s are for conversions. They basically mean change this object into an Array or a Sring, however it makes sense to do that for the current object. In contrast, to_ary/to_str are for objects that essentially are enhanced versions of Array or String. They mean, it's OK to pretend this object is an Array or a String. Perhaps I'm wrong though. James Edward Gray II