WAT: opCmp and opEquals woes

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Fri Jul 25 13:35:35 PDT 2014


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.


More information about the Digitalmars-d mailing list