toHash() and Interfaces
Stewart Gordon
smjg_1998 at yahoo.com
Wed May 11 16:43:03 PDT 2011
On 06/05/2011 13:02, Steven Schveighoffer wrote:
<snip>
> D has this horrible notion that any interface can be for a COM object, even though COM
> interfaces can only inherit from IUnknown (known statically). Therefore, interfaces that
> don't inherit from IUnknown are not considered Objects, even though they could and should be.
Firstly, IUnknown is defined in the Phobos files, not a language built-in. There might be
multiple IUnknowns, defined in different modules (e.g. because some set of bindings has
its own copy). How should the compiler identify the IUnknown to use? By name? By the
signatures of functions specified within it? By fully qualified name?
Secondly, I guess it's perfectly possible for some other system, besides COM, to create
non-D objects that implement D interfaces.
> So you have to manually cast an interface to Object in order to call an Object function.
Which you can do, if you are certain that the object will always be a D object. I guess
the whole point is to protect you from those cases where you can't be sure.
Stewart.
More information about the Digitalmars-d-learn
mailing list