Todd Benson
5/27/2008 2:36:00 PM
On Tue, May 27, 2008 at 6:34 AM, Tobias Weber <towb@gmx.net> wrote:
> Hi,
> maths says that the value of expressions like x == y and y == x is
> always equal. And indeed most programmers wouldn't think twice about
> using x < y instead of y > x (except maybe those versed in machine
> language...).
> But direction does matter in ruby, where operators are just messages
> sent to the left operand. This often bites me when using ===.
>
> Have you had bugs fixable by rotating an expression?
Operators depend on context (think of the use of <). === is no
different. There are, after all, a limit to the symbols you want to
remember, right :-)
A number of symbols cannot be overridden during the interpretation of
a script/program, such as &&, ternary operator, assignment operators,
and several others.
When, I first saw ===, I immediately hit the docs out of curiosity,
having never seen it before, and therefore never had a problem with
it.
Todd