WAT: opCmp and opEquals woes

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Fri Jul 25 11:58:41 PDT 2014


On Friday, 25 July 2014 at 18:54:07 UTC, Daniel Gibson wrote:
> Am 25.07.2014 20:45, schrieb Jonathan M Davis:
>> On Friday, 25 July 2014 at 13:34:55 UTC, H. S. Teoh via 
>> Digitalmars-d
>> wrote:
>>> On Fri, Jul 25, 2014 at 09:46:55AM +0000, Jonathan M Davis via
>>> Digitalmars-d wrote:
>>>> Even worse, if you define opEquals, you're then forced to 
>>>> define
>>>> toHash, which is much harder to get right.
>>>
>>> If you're redefining opCmp and opEquals, I seriously question 
>>> whether
>>> the default toHash actually produces the correct result. If 
>>> it did, it
>>> begs the question, what's the point of redefining opCmp?
>>
>> Except that with the current git master, you're forced to 
>> define
>> opEquals just because you define opCmp, which would then force 
>> you to
>> define opCmp.
>
> That sentence doesn't make much sense, did you mean "opHash 
> just because you define opEquals" or something similar?

You're right. I meant that you would then be forced to define 
toHash.

- Jonathan M Davis


More information about the Digitalmars-d mailing list