opCmp and opEquals woes

Daniel Murphy via Digitalmars-d digitalmars-d at puremagic.com
Fri Jul 25 00:34:50 PDT 2014


"Jonathan M Davis"  wrote in message 
news:zcutsbuilcttvbuahmlc at forum.dlang.org...

> If that's the case, then the default opEquals isn't correct, and the 
> programmer should have already defined opEquals. If they didn't, then 
> their code is broken, and I see no reason to penalize the folks who wrote 
> correct code just to fix someone else's broken code by then defining 
> opEquals in terms of opCmp.

Just because not all fields _need_ to be compared doesn't mean the default 
opEquals was incorrect.  The ignored fields could be cached values 
calculated from the other fields. 



More information about the Digitalmars-d mailing list