On 6/27/06, Alexandru Popescu <the.mindstorm.mailinglist / gmail.com> wrote:
> #eql? is just syntactic sugar of #==, needed for objects used as keys
> in hashes (because hash implementation doesn't like to use #==, but
> only #eql?). If your class needs to override #==, than just delegate
> #eql? implementation to #==.

While this a fairly good and useful statement, I would reword it just
a little bit to qualify that #eql? doesn't *have* to be synonymous
with #==. It usually is, and unless you're doing something far from
the norm it will be, but to call it "syntactic sugar" is not quite
accurate. I'd try a rewording like:

"#eql? is used in hash key collision resolution. Under nearly all
circumstances, #eql? will be synonymous with #==, and if your class
needs to override #== it will be sufficient to alias #eql? to #==.
Just note there are rare exceptions."

Jacob Fugal