hash - Why does Ruby hashes use eql? and not == -


i see many notions of equality in ruby.

== eql? === equal? 

and of them have different semantics. me there ought 2 of them, 1 reference equality , other value equality. don't see why ruby needed eql? , ===.

i found this question says distinction value , value , type.

specifically, don't understand why hash need check type (which test in == method itself)

hash requires keys must support eql? because needs hash code internally.

for example, 1 == 1.0 true, while 1.eql? 1.0 false. 1 , 1.0 have different hash codes, can't treated equivalent keys in hash.


Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -