4 ms·
I'm not sure you're contradicting the author as much as taking his argument a step further. His second example is arguing for value-equality instead of referen
by mrkeen 6y ago
I'm not sure you're contradicting the author as much as taking his argument a step further. His second example is arguing for value-equality instead of reference-equality as a saner default. He created two "value-ish" Customer objects and used them to motivate his argument.
So when he writes:
>> Why not make the objects equal by default, and make reference equality testing the special case?
this refers in particular to these value objects.
I completely agree with you that InputStream should not have equals defined. A sane language would not conflate values with classes, and InputStream is not a value.
So perhaps it could be better-written as:
If defined, equality should test by value, rather than by reference.