Sorry, I didn't see this message when I posted the last one.

Em 11-01-2011 15:09, Charles Nutter escreveu:
> Issue #4264 has been updated by Charles Nutter.
>
>
> Other thoughts after talking with tenderlove:
>
> 1. double-dispatched protocol
>
> The #to protocol could double-dispatch against the class, as in:
>
> def to(type)
>    type.coerce(self)
> end
>
> This would allow defining coercions on the target class, rather than on the #to method. It does incur the hit of doing a double-dispatch though.
>
> 2. symbolic types
>
> Allowing a symbol could make it possible to define coercions based on name alone, such as obj.to :yaml or obj.to :json. A default impl of coerce could be added to Symbol:
>
> class Symbol
>    def coerce(obj)
>      obj.send "to_#{self}"
>    end
> end
>
> Given the double-dipatched protocol, the above may be left for users to implement, but it serves a similar purpose to the now-standard Symbol#to_proc.