Hacker News new | ask | show | jobs
by icebraining 3897 days 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.
1 comments

For "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.
But 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.