On 26 July 2014 06:35, Walter Bright via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
On 7/25/2014 5:10 AM, Ary Borenszweig wrote:
Not at all.

If you have a type that has partial ordering (only cares about opCmp, not about
opEquals), but still keeps the default opEquals, then this would silently break
someone's code by changing their opEquals semantic.

THIS is the breaking change.

Yes. A subtle but extremely important point. Comparison and Equality are fundamentally different operations. Defining opEquals to be the equivalent of opCmp==0 is utterly breaking that.

Perhaps the problem here is that there is a missing concept.
There is equality and equivalence, and only equivalence is expressed in D (ie, the one that is relevant among the suite of comparison operations).

Would you argue that == and != are unrelated, distinct and separate operations from <,<=,>=,>, and they should never be used in conjunction, or assumed to be related?
I think any reasonable person will assume that the suite of comparisons are related operations.
So perhaps === is missing, and that's what should be used for AA's, and also the thing that actually matches the compiler's generated opEquals...?