Issue #12897 has been updated by Nobuyoshi Nakada.

Status changed from Feedback to Rejected

I missed `0.0` and `0`.

----------------------------------------
Bug #12897: Hash failed to recognize the existed key and send not found when using Vector as key
https://bugs.ruby-lang.org/issues/12897#change-61304

* Author: Ұ խ
* Status: Rejected
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.0.0p648 (2015-12-16 revision 53162) [x86_64-linux] 
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
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.



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>