WAT: opCmp and opEquals woes

Manu via Digitalmars-d digitalmars-d at puremagic.com
Fri Jul 25 20:33:10 PDT 2014


On 26 July 2014 06:38, Walter Bright via Digitalmars-d <
digitalmars-d at puremagic.com> wrote:

> On 7/25/2014 4:10 AM, Regan Heath wrote:
>
>> Sure, Andrei makes a valid point .. for a minority of cases.  The
>> majority case
>> will be that opEquals and opCmp==0 will agree.  In those minority cases
>> where
>> they are intended to disagree the user will have intentionally defined
>> both, to
>> be different.  I cannot think of any case where a user will intend for
>> these to
>> be different, then not define both to ensure it.
>>
>
> You've agreed with my point, then, that autogenerating opEquals as
> memberwise equality (not opCmp==0) if one is not supplied will be correct
> unless the user code is already broken.
>

No, because there's no obvious reason to define opEquals if you do define
opCmp, and the opEq
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20140726/a3c906ac/attachment-0001.html>


More information about the Digitalmars-d mailing list