[Issue 4088] opEquals not called on interfaces

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Oct 15 02:56:37 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=4088



--- Comment #10 from Kenji Hara <k.hara.pg at gmail.com> 2011-10-15 02:55:26 PDT ---
https://github.com/D-Programming-Language/druntime/pull/72

(In reply to comment #8)
> 1. what should happen if this is called with a COM object?

If two interfaces are identity comparable, returns its result. Otherwise,
downcast to Object, and the result is false.
And this rule also appleied to C++ interface (COM interface is C++ interface,
and the downcasting from C++ interface to Object returns always null).

> 2. how does an opEquals defined in an interface interact with the
> object.opEquals?

An interface's opEquals is not used directly. Object.opEquals is always used
for the interface comparison when it is possible.

> 3. a forced cast, unlike an implicit cast, is a blunt instrument that can do a
> lot more than simply cast an interface to its base class. If the arguments are
> other types, what are the conseqences of this forced cast?

Same as Steven's comment in #9.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list