Hi,
In message "[ruby-talk:10842] Possible bug in Hash implementation"
on 01/02/14, "Aristarkh A Zagorodnikov" <xm / w3d.ru> writes:
| First, I want to excuse - because this may be not a bug in ruby, but a bug
|in my DNA ;)
It's not a bug, but I don't think it's your bug either. ;-)
In short, don't use `$='; it's too dangerous.
Here's a bit longer explanation:
Changing value of `$=' affects hash value of strings, e.g.
a = "abCDEf"
p a.hash # 873054506
$= = true
p a.hash # -153552695
Hashes are screwed up when hash values of keys are changed.
You have to call Hash#rehash if hash values are changed.
See "the book" page 129.
I think the problem lies on the fact there's no way to compare case
insensitively but using `$=' or regexp (or defining one's own class).
matz.