Behavior of opEquals

via Digitalmars-d digitalmars-d at puremagic.com
Tue Sep 8 10:02:45 PDT 2015


On Thursday, 3 September 2015 at 06:37:20 UTC, Jacob Carlborg 
wrote:
> On 2015-09-02 22:25, w0rp wrote:
>
>> Yeah, I would just call super.opEquals, like so.
>
> I know that's the workaround, but the question is if it's a 
> good implementation/behavior of opEquals.

Strictly speaking OO equality ought to yield three outcomes: yes, 
no, maybe.

You can't really tell if an instance of Cat and and instance of 
Animal are equal based on features. It would be better to project 
an aspect of the instance and compare that instead ("equally 
powerful" etc).



More information about the Digitalmars-d mailing list