On Thu, 12 Jul 2012 18:38:06 -0400, Andrei Alexandrescu <seewebsiteforem...@erdani.org> wrote:

On 7/12/12 4:50 PM, Steven Schveighoffer wrote:

My personal opinion is we should simply eliminate the four methods (or
at least the three required for AAs), fix AAs, and deal with the
fallout. I can't really remember the last time I simply used
obj1.opEquals(obj2) to do comparisons instead of obj1 == obj2 (which
should do the right thing if obj1.opEquals(obj2) is valid). The code
that relies on this is probably very rare. I certainly would *love* to
rewrite all my opCmp and opEquals functions to accept the minimal base
class instead of doing the dual dispatch dance with Object parameters.

I agree not a lot of people use obj1.opEquals(obj2) instead of obj1 == obj2, but I assume quite a few override opEquals and rely on it being called.

(fixed above for you)

Yes, and why would that not work?  If opEquals is defined as:

bool opEquals(Object o)

Won't this still be called by the compiler, even if Object does not define it? (assuming the extraneous override keyword is removed)

This would be an issue if people stored all their objects as Objects, which is very rare also I think.

-Steve

Reply via email to