On 9/26/07, murphy <murphy / rubychan.de> wrote: > Hello! > > Let's say we define an object x which is equal to everything: > > x = Object.new > def x.== other > true > end > > Using this element in array operations gives me unexpected results: > > # as expected > x == 3 # => true > [1, 2, 3] == [x, x, x] # => true > [1, 2, 3] === [x, x, x] # => true > [1, 2, 3].include? x # => true > [1, 2, 3].index x # => 0 > [1, 2, 3].delete(x) # => #<Object:0x48ea68> Actually, some of these surprise me, since although x might == every object, every object does not == x x = Object.new def x.== other true end x == "abc" # => true "abc" == x # => false x == :symbol # => true :symbol == x # => false x == nil # => true nil == x # => false x == 3 # => true 3 == x # => true The last, and the one which makes your examples work "as expected" is an artifact of the implementation of FixNum#== I'm not sure whether it's a bug or not, it's definitely an edge case. -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/