"Gavin Kistner" <gavin / refinery.com> schrieb im Newsbeitrag news:xkbZb.346875$I06.3646685 / attbi_s01... > Gavin Kistner wrote: > > irb(main):006:0> foo===Array > > => false > > > > Line 4 confirms what Kent pointed out...but line 6 seems to indicate > > that the case statement switching off of the instance itself (which does > > work) should not work. > > Nevermind, I was confusing the appearance of === as a commutative > operator with the fact that it's actually a method call. Btw: == is a method call, too. You can't define operators independent of a class in Ruby. All operators that you can define, have to sit in a class. It's just the syntax ("a + b") that mimics independence and commutability. > (foo===Array) != (Array===foo) > > and apparently the latter is the order that is used in a case statement. > > I can see the reason that Module#=== was thus defined (and the power > that the definition enables)...but the principle of most surprise > strikes again :) Well, that's just a normal event during learning: you're surprised by something you didn't know beforehand, investigated and learned something. Nothing that would indicate that POLS is violated. :-) Kind regards robert