struct inheritance need?
Weed
resume755 at mail.ru
Tue Dec 16 08:08:37 PST 2008
bearophile пишет:
> Weed:
>> Planned in the future to implement inheritance of structs or the
static creation of classes?
>
> Inheritance of structs: I think it's not planned. Structs in D are
meant to be used for different things than classes.
> Yet, as time passes structs are gaining more power: you can't believe
>
that very recently they have gained constructors/destructors too in D2.
Probably in a system language conceptual purity isn't much appreciated :-)
>
I believe that the opportunity to place an object in memory, stack or
heap is more important than the struggle against "splicing".
I think not worth taking structs and classes from C#. May be bytecode
interpreter C# does not show the difference in speed between the
allocation of memory by a small object + its using and the use of a
static object, so developers C# decided to do so as done. (but I am not
a specialist in the design of compilers :))
> Static creation of classes (I think you mean creation of objects): it
> sounds like an interesting thing, I know of a system language that
> allows the creation of objects only at compile-time, and at
> compile-time it also performs several space optimizations among such
> objects (and such space optimizations often improve running speed a
> little).
And in fact we come to making structs and classes similar except that
classes can not be assigned by value.
Such an option I like.
More information about the Digitalmars-d-learn
mailing list