WAT: opCmp and opEquals woes

Tobias Pankrath via Digitalmars-d digitalmars-d at puremagic.com
Fri Jul 25 07:52:11 PDT 2014


>> And it's not like we're making it impossible in the minority 
>> case -- if
>> you want a non-linear partial ordering, wouldn't you make sure 
>> to define
>> both opCmp and opEquals so that they do the right thing? Since 
>> it's an
>> uncommon use case, people would tend to be more careful when
>> implementing it.
>
> Do I miss something or wouldn't an non-linear ordering imply, 
> that x.opCmp(y) != 0 for all x,y ∈ T and thus automatically 
> generating opEquals to opCmd() == 0 would automatically do the 
> right thing in this case?
>
> So the amount of people that require a different opEquals are 
> even smaller
> and defining opEquals and opCmp for two different orderings is 
> a code smell squared.

A nevermind, got my hands on a coffee now.


More information about the Digitalmars-d mailing list