J
Just Another Victim of the Ambient Morality
Not too long ago, there was a thread about a bug in Ruby where vectors
(which turned out to be derived from matrices) failed to work as hash keys.
The problem turned out to be a typo in the definition of the Matrix class.
The method "eql?" is used by hashes for key comparison but, in the Matrix
class, this method was named "eqn?" by mistake.
This got me thinking about the role of the "eql?" method. Why does it
exist? What is the Ruby rationale behind having two different equality
methods, namely "==" and "eql?"
Thank you...
(which turned out to be derived from matrices) failed to work as hash keys.
The problem turned out to be a typo in the definition of the Matrix class.
The method "eql?" is used by hashes for key comparison but, in the Matrix
class, this method was named "eqn?" by mistake.
This got me thinking about the role of the "eql?" method. Why does it
exist? What is the Ruby rationale behind having two different equality
methods, namely "==" and "eql?"
Thank you...