class BoringClass
end
class CoolClass
def ==(other_object)
other_object.is_a? MyClass
end
end
BoringClass.new == BoringClass.new #=> false
CoolClass.new == CoolClass.new #=> true!
- Seems like that
MyClass
should beCoolClass
- I always prefer realistic examples
Symbol('foo') !== Symbol('foo'); // true!
I'd rather see that as
Symbol('foo') === Symbol('foo'); // false!
Near the beginning of the material about symbols, I could use a numbered list of use cases driving the addition of symbols. Eventually it's clear after reading the lengthy descriptions of what the do, what they don't do, and how they integrate for operator overloading type scenarios, but at the beginning I didn't have a good set of mental boxes to be filled so the information just piles up disorganized in my short-term memory.
The back story on Symbol.unscopables is good context.