Is it time to deprecate COM compatibility through D interfaces?
Jason House
jason.james.house at gmail.com
Wed Apr 14 05:22:59 PDT 2010
Steven Schveighoffer Wrote:
> Given that structs have become extremely powerful, and with the advent of
> opDispatch, would it be possible to deprecate supporting COM via D
> interfaces in favor of a library solution?
Don suggested defining them the same way as C++ classes.
>
> There are some crappy drawbacks for having interface be dual-purposed:
>
> - Although 99.9% of interfaces are actually instances of Object, you can't
> call Object functions directly on an interface. This includes opEquals,
> opCmp, toString and friends.
> - They are not implicitly castable to Object.
> - There is no centralized base interface, so there is no argument type you
> can use that can accept any interface. For instance, if you wanted to do
> some runtime reflection to determine an interface's methods or something.
> - All these drawbacks are absolutely pointless on non-Microsoft OSes.
Casting interfaces is frequently an expensive runtime operation. It's the price that we pay for allowing more than single inheritance with interfaces. I don't like the idea of implicitly doing expensive operations.
More information about the Digitalmars-d
mailing list