4 ms·
Reference equals doesn't make sense for a value object anyway.
by UK-Al05 4y ago
Reference equals doesn't make sense for a value object anyway.
- quickthrower2 4y agoUnless you are using immutable objects. Then efficient equality check is referenceEquals() || deepEquals()
- nine_k 4y ago1 is an immutable object, and in languages such as Java or C++ it's not a reference-type object. You meant heap-allocated immutable objects, like some kind of a Haskell list, or maybe small stack-allocated immutable objects, like a tuple.
- int_19h 4y agoThat should be in the guts of the implementation of == for value types, not something exposed outside of it.
- quickthrower2 4y agoYes I agree, in Haskell it is derived, for example.