A fresh look at comparisons

Janice Caron caron800 at googlemail.com
Tue Apr 15 02:54:36 PDT 2008


On 15/04/2008, Scott S. McCoy <tag at cpan.org> wrote:
> I agree that's tricky, but isn't it infact true that opEquals is defined
>  as a multimethod?
>
>  It appears to be, please follow ...
>  http://codepad.org/wxG1AKBe

But that won't work if you compile with -w, because then you have to
use the override keyword, which in turn insists that opEquals have the
same signature as in Object.


>  So maybe you would just like it to return bool, as opposed to int?

No. That is, of /course/ I want it to return bool, but I don't /just/
want it to return bool. This proposal is all about ditching
inheritance and replacing it with a compiler-generated default
implementation, which results in very different (but, in my opinion,
correct) behavior for comparisons.

If all you want is for opEquals to return bool, there is a different
thread for that discussion.



More information about the Digitalmars-d mailing list