On Wed, 14 Apr 2010 09:34:38 -0400, Fawzi Mohamed <[email protected]> wrote:
On Wed, 14 Apr 2010 08:22:59 -0400, Jason House
<[email protected]> 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