Why can't we derive struct's?

Guillaume Piolat first.last at gmail.com
Fri Dec 21 15:39:39 UTC 2018

On Thursday, 20 December 2018 at 03:42:08 UTC, Walter Bright 
> Because polymorphism makes little sense for a value type.

What happens is in D we often want:
A - deterministic destruction
B - reference semantics
C - sub-typing (interfaces / alias this)

`class` does B and C, and even A when emplaced, but not that easy 
to use. Don't work in -betterC. GC will call destructors which 
breaks (A) if we aren't careful.

`struct` does A, B when wrapped, that not C very well.

More information about the Digitalmars-d mailing list