WAT: opCmp and opEquals woes

via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 23 15:42:19 PDT 2014


On Wednesday, 23 July 2014 at 18:53:57 UTC, H. S. Teoh via 
Digitalmars-d wrote:
> That's the wrong way round. I fully agree that we should not
> autogenerate opCmp if the user defines opEquals, since not all 
> types
> comparable with equality are orderable.  However, surely all 
> orderable
> types are equality-comparable! Therefore, if opCmp is defined 
> but
> opEquals isn't, then we should autogenerate opEquals to be the 
> same as
> a.opCmp(b)==0.

You can define an order for sets/intervals without equality... 
For fuzzy numbers it gets even worse. You can define it such that 
a<b and b>a both are true...



More information about the Digitalmars-d mailing list