On Wed, Feb 22, 2012 at 08:51:50PM -0500, Kevin wrote:
> I have the following code which gives the same result on ldc2 and
> dmd.  If I compare two objects of different classes I always get
> false even though the comparator is called.
[...]
> The key thing to notice is that opEquals() gets called both times.
> Any ideas about what is happening?

It's because when A and B are different types, the compiler translates
A==B to:

        A.opEquals(B) && B.opEquals(A)

Both parties need to agree before they are considered equal.


T

-- 
Shin: (n.) A device for finding furniture in the dark.

Reply via email to