Why can't structs be derived from?
Jens
jne at somewhere.org
Tue Mar 15 13:46:43 PDT 2011
Daniel Gibson wrote:
> Am 15.03.2011 21:29, schrieb Jens:
>> Daniel Gibson wrote:
>>> Am 15.03.2011 21:07, schrieb Jens:
>>>> How is it different in D where all polymorphic objects are
>>>> reference types? Take have the design space away, make everything
>>>> a glorified pointer and things are better?
>>>
>>> They obviously are. Successful languages like Java and C# do it.
>>> It's less error-prone and you don't have to worry about
>>> dereferencing stuff all the time (sometimes even multiple
>>> dereferences at once, like in my example).
>>
>> More toward Java-class-language then than C++-level language.
>> Sacrificing stack objects was like throwing out sharp knives from
>> the kitchen. I understand.
>>
>
> If you want value types use structs. Maybe with alias this or mixins
> to "extend" them.
> Or use emplace (see
> http://www.digitalmars.com/d/2.0/phobos/std_conv.html ) with classes
> if you wanna play with sharp tools.
> It's not like you can't (risk to) cut yourself with D, it's just
> easier not to.
While the above was off-topic, I was alluding to class objects on the
stack. So not to turn the thread into a critique of the entire language,
I'll leave it at that.
More information about the Digitalmars-d
mailing list