Fixing opEquals and opCmp

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Sat May 13 11:52:48 PDT 2017


On 13.05.2017 16:17, H. S. Teoh via Digitalmars-d wrote:
> On Sat, May 13, 2017 at 01:21:12PM +0000, Fool via Digitalmars-d wrote:
>> On Saturday, 13 May 2017 at 12:53:33 UTC, Nicholas Wilson wrote:
> [...]
>>> 3) you can do that already. w.r.t sort you pass a predicate
>>> (defaulting to "less") for which ordering is assumed to exist, if it
>>> doesn't then you get a partition according to that predicate.
>>
>> Another misunderstanding. Currently, there is no means to express that
>> 'less' models a partial order vs. a linear order.
>
> Wrong.  Andrei specifically stated before that opCmp may model a partial
> order, i.e., returning 0 may indicate "not comparable" rather than
> "equal".  And this is why opEquals is necessary: to distinguish between
> "not comparable" and "equal".
>
>
> T
>

I can't seem to find the post you are referring to but IIRC it was 
immediately destroyed completely.


More information about the Digitalmars-d mailing list