Actions
Bug #12897
closedHash failed to recognize the existed key and send not found when using Vector as key
Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 2.0.0p648 (2015-12-16 revision 53162) [x86_64-linux]
Description
When I was using Vector as the key to the Hash, Hash sometimes failed to recognize the key and send nil, while the key-value pair actually existed.
Example as followed:
irb(main):002:0> require"matrix"
=> true
irb(main):003:0> Vector[0.1E1, 0.2E1, 0.0] == Vector[0.1E1, 0.2E1, 0]
=> true
irb(main):004:0> p = { Vector[0.1E1, 0.2E1, 0.0] => 1}
=> {Vector[1.0, 2.0, 0.0]=>1}
irb(main):005:0> p.has_key?(Vector[0.1E1, 0.2E1, 0])
=> false
irb(main):006:0> Vector[0.1E1, 0.2E1, 0] == Vector[0.1E1, 0.2E1, 0.0]
=> true
As you can see, the key is corrected recognized, but the Hash could not recognize it.
Actions
Like0
Like0Like0Like0Like0