From: Caleb Clausen Date: 2010-07-06T22:07:05+09:00 Subject: Re: WTF? Case statement disfunctional? On 7/6/10, Pieter Hugo wrote: > Hi guys > > Thanks for the prompt and helpful responses. Your proposals work, but I > am still unhappy about spending an hour tracking this bug. > > So CASE uses '===' and not '==', am I correct? So why does > > a = 1 > a === Fixnum > > ==> false but, Fixnum===a #=>true === is not symmetric with respect to its arguments. I forget what the right word for that is. > Furthermore, In my original example, one would expect a.class === Fixnum > to return true in any case, as '===' is supposed to be more forgiving > than '==', but it doesn't. Don't think of === as a 'more forgiving' ==. It doesn't provide a superset of =='s behavior; it's more like a better equality operator for use in case expressions. === actually has rather complicated semantics which depend on the type of its left-side argument, so it's hard to come up with a pithy one-line description.