WAT: opCmp and opEquals woes

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 23 16:01:08 PDT 2014


On Wed, Jul 23, 2014 at 10:42:19PM +0000, via Digitalmars-d wrote:
> 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...

(a<b && b>a) is true for ints.


T

-- 
All men are mortal. Socrates is mortal. Therefore all men are Socrates.


More information about the Digitalmars-d mailing list