www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2794] New: Compatibility between class and interface

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2794

           Summary: Compatibility between class and interface
           Product: D
           Version: 1.042
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: benoit tionex.de


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.


-- 
Apr 03 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2794


benoit tionex.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|1.042                       |2.026




------- Comment #1 from benoit tionex.de  2009-04-03 14:33 -------
I changed to D2 compiler.


-- 
Apr 03 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2794


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies gmail.com
         Resolution|                            |DUPLICATE


--- Comment #2 from yebblies <yebblies gmail.com> 2011-06-10 08:59:07 PDT ---
*** This issue has been marked as a duplicate of issue 4088 ***

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