Trans
2/4/2007 6:08:00 PM
On Feb 4, 11:28 am, Yukihiro Matsumoto <m...@ruby-lang.org> wrote:
> Hi,
>
> In message "Re: Hash#rekey"
> on Sun, 4 Feb 2007 04:49:08 +0900, "Trans" <transf...@gmail.com> writes:
>
> |I think he backed off making Symbol a subclass of String, but I think
> |he's still considering auto-coercing symbol to string, or at the very
> |least that they will have some sort of equality for use as hash keys.
> |Matz?
>
> No. "foo" and :foo are different keys in a hash.
And never the twain shall meet? So it's long live
HashWithIndifferentAccess ?
A while back I offered the idea of being able to define a key coerce
proc, eg.
h = Hash.new.key!{ |k| k.to_s }
Such that keys would always be strings. Might someting like that be a
viable solution?
In anycase, I still offer up #rekey.
T.