Summary: Compatibility between class and interface
           Product: D
           Version: 1.042
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD

Object references and those to interfaces shall be compatible.

interface I {}
I i1 = getInstance();
I i2 = getAnotherInstance();
Object[] array;
// this does not compile, but it should:
bool res = (i1 == i2);
array ~= i1;
// instead this is atm needed:
bool res = (cast(Object)i1).opEquals( cast(Object) i2 );
array ~= cast(Object)i1;

That implies, each interface shall have the methods from Object.
Each interface shall be implicit castable to Object.

For the case, an interface is derived from IUnknown the compiler can handle
those interfaces special, and remove the compatibility.


Reply via email to