opCmp, [partial/total/pre]orders, custom floating point types etc.
    John Colvin via Digitalmars-d 
    digitalmars-d at puremagic.com
       
    Tue Jan 12 11:13:29 PST 2016
    
    
  
On Tuesday, 12 January 2016 at 19:00:11 UTC, Andrei Alexandrescu 
wrote:
> On 01/12/2016 01:27 PM, John Colvin wrote:
>> Preorder or partial order: not possible in D, opCmp insists on 
>> totality.
>
> The way I look at it, a partial order would implement opCmp and 
> opEqual such that a < b, b < a, and a == b are simultaneously 
> false for unordered objects. Would that float your boat? -- 
> Andrei
a<=b and b<=a must also be false. That would work for a partial 
order, yes. Unfortunately, that's not possible with the current 
opCmp design, hence my 2 suggestions for improvements (I'm pretty 
sure the second one is better).
The key thing is to have a design that doesn't enforce totality.
    
    
More information about the Digitalmars-d
mailing list