From: Martin DeMello Date: 2009-05-13T04:41:36+09:00 Subject: [ruby-core:23437] Re: [Bug #1363] Wrong value for Hash of NaN On Tue, May 12, 2009 at 12:20 PM, Yukihiro Matsumoto wrote: > Using float values as hash keys should be strongly discouraged, > because you may not have expected result anyway. �a 3.14 may be > different in bit-wise representation from another 3.14. �I have no > plan to prohibit using them as keys, right now, but see no need to > change the language to encourage bad habit. �If I have to make a > change related to this issue, I'd rather prohibit NaN as a key (or > float keys in general), as in [ruby-core:23426]. Personally, I would love to see floats prohibited as hash keys, with the effect rippling outwards so that composite objects containing floats weren't valid hash keys either unless you overrode their hash method. I know the philosophy of ruby is to give users the power to shoot themselves in the foot, but as you say, people who know what they're doing won't use it anyway, and people who don't know about the pitfalls involved would appreciate the safeguard. If you are even vaguely contemplating this change, isn't now a good time to do it? martin