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>
# unexpected
[1, 2, 3] - [x] # => [1, 2, 3]
[1, 2, 3] & [x] # => []
[1, 2, 3] | [x] # => [1, 2, 3, #<Object:0x48ea68>]
[1, 2, 3, x].uniq # => [1, 2, 3, #<Object:0x48ea68>]
Is this a feature? Why do some methods use "=="-equality and others
"eql?"-equality?
[murphy]