[D-runtime] Two questions about object opEquals

Simen Kjærås simen.kjaras at gmail.com
Sat Mar 9 12:00:07 PST 2013


On Sat, 09 Mar 2013 16:28:50 +0100, kenji hara <k.hara.pg at gmail.com> wrote:

> I don't know why following. Can someone answer?
>
> 1. Object.opEquals(Object lhs, Object.rhs)
>
> It seems to me that nobody uses it. Why it exists?
>
> 2. object.opEquals(TypeInfo lhs, TypeInfo rhs)
>
> It might be used to hack for typeid(x) == typeid(y), but I'm not sure.
> That is much ambiguous, and if it's really used, we should move it to  
> static TypeInfo.equals and explicitly use it by the name.
>
> Kenji Hara

I might be misremembering, but I seem to recall objA == objB is rewritten  
into Object.opEquals(objA, objB). Object.opEquals(Object lhs, Object rhs)  
then does the actual two-way comparison of objA.opEquals(objB) &&  
objB.opEquals(objA).

-- 
Simen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/d-runtime/attachments/20130309/39b4d44f/attachment.html>


More information about the D-runtime mailing list