Is it time to deprecate COM compatibility through D interfaces?

Steven Schveighoffer schveiguy at yahoo.com
Wed Apr 14 07:08:31 PDT 2010


On Wed, 14 Apr 2010 09:34:38 -0400, Fawzi Mohamed <fawzi at gmx.ch> wrote:

>> On Wed, 14 Apr 2010 08:22:59 -0400, Jason House  
>> <jason.james.house at gmail.com> wrote:
>>
>>> Don suggested defining them the same way as C++ classes.
>>
> I like this, implicit casting to object would be very convenient, but  
> note that that precludes the possibility of ever having structs  
> implement interfaces (not that they should, but as of now it is kind of  
> possible to imagine).

I don't think this will ever happen.  Since D is moving towards outlawing  
referencing stack data in safeD, this would mean struct interfaces are  
most likely illegal in safeD.

Add to this the fact that then structs need a vtable, and you have started  
to stray from some of the benefits of structs.  I just don't see it being  
worth it.  And I did want struct interfaces too.

We always have compile-time interfaces for structs (i.e. template  
constraints) that also work on classes.

-Steve



More information about the Digitalmars-d mailing list