I know it's a method, but why doesn't Fixnum's === work properly with
ranges?
That should be the expected behavior, the expression is just as true one
way as it is the other.
I'm reading this as incredibly whiny, childish, and obnoxious, but
that could be totally my own perception.
The whole point of Ruby is that if you don't want things to happen the
way they happen, you can rewrite large portions of the language -
including this piece - with very little effort. So not only is it
pointless to tell people what the language should do, but also, if you
really want the language to do that, you can **make** it do that with
hardly any effort at all.
Anyway. The reason threequals doesn't behave the way you expect it to
is because you don't know what it's for. It's not something you should
use in day-to-day code. It's not an equality operator. That's why it
doesn't have the associative property which equality has. Threequals
is for defining how a class should be evaluated in a case/when
statement. Unless you're defining how a class should be evaluated in a
case/when, you shouldn't be using threequals.
So threequals is in fact working properly. You just don't know how to
use it. The way to use it is to define a new class and then use
threequals to define how a case/when will evaluate that class. Many,
many people will never ever need to do this, because it's a relatively
esoteric use case.
More detail, and less grumpiness:
http://gilesbowkett.blogspot.com/2007/11/what-is-threequals.html
--
Giles Bowkett
Podcast:
http://hollywoodgrit.blogspot.com
Blog:
http://gilesbowkett.blogspot.com
Portfolio:
http://www.gilesgoatboy.org
Tumblelog:
http://giles.tumblr.com