Project

General

Profile

Bug #11508

Updated by nobu (Nobuyoshi Nakada) over 8 years ago

~~~ruby ~~~ 
 {a:1,b:2}.eql?({b:2,a:1}) 
 => true 
 ~~~ 

 The `eql?` eql? (aka `==`) ==) operator on hashes does not compare the ordering of the compared hashes. 

 This behaviour is documented in `Hash#==` Hash#== (and should not be touched, ever) 

 I'd like to suggest: 

 
 - extend the documentation of `Hash#==` Hash#== to *explicitely* state, that ordering is not compared 
 - add a new function in ruby5 to compare hashes with respect of the ordering, 
    aka `{a:1,b:2}.eql_with_order?({b:2,a:1})` {a:1,b:2}.eql_with_order?({b:2,a:1}) => `false` false 










Back