Hacker News new | past | comments | ask | show | jobs | submit login

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.



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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: