3 ms·
But even in core Ruby, == is not always identity; hashes, arrays, ranges, all of them are compared by value and not by identity. The assumption that == is compa
by icebraining 11y ago
But even in core Ruby, == is not always identity; hashes, arrays, ranges, all of them are compared by value and not by identity. The assumption that == is comparing identity is broken, not the code that implements it differently.
- wdewind 11y agoFor "primitives" yes, for objects no. What would be primitives in Ruby extend Object, because everything in ruby does, but (sigh) they redefine == so they act more like primitives in other languages. At least there is a clear cut rule, but it's pretty much turtles all the way down.
- icebraining 11y agoBut there are no primitives in Ruby, that's the point. Everything is an object, and some objects extend ==, others don't, even in the core language.