Any plans to support STL value types?

w0rp via Digitalmars-d digitalmars-d at puremagic.com
Tue May 19 05:13:08 PDT 2015


JMD is right. Using inheritance for value types is a bad idea, 
and it shouldn't be done.

The problem is that when you assign a derived value type to a 
base value type, the members in the derived type are removed, and 
this can lead to very weird behaviour. You could enforce that 
derived value types can never add any members, but then what 
would be the point? For adding virtual method calls for changing 
behaviour?

Using inheritance for reference types only was one of the better 
design decisions for D. If you want to treat a set of structs in 
a similar way, you can do it better with parametric polymorphism 
than with classes and virtual method calls.


More information about the Digitalmars-d mailing list