Why can't structs be derived from?

Regan Heath regan at netmail.co.nz
Wed Mar 16 05:34:06 PDT 2011


On Tue, 15 Mar 2011 19:42:20 -0000, Jens <jne at somewhere.org> wrote:

> Steven Schveighoffer wrote:
>> On Tue, 15 Mar 2011 15:28:09 -0400, Jens <jne at somewhere.org> wrote:
>>
>>> Steven Schveighoffer wrote:
>>>> On Tue, 15 Mar 2011 14:54:13 -0400, Jens <jne at somewhere.org> wrote:
>>>>
>>>>> I didn't ask how to do composition in D. I asked why composition
>>>>> cannot be done via derivation, i.e., the reasoning behind the
>>>>> language design choice. A design faux paus IMO.
>>>>
>>>> Because composition by inheritance can be *completely* implemented
>>>> using alias this -- a feature that also provides other niceties. Why
>>>> provide another mechanism to do the exact same thing, just
>>>> because you are used to it?
>>>
>>> 1. I'm not convinced the other functionality is necessary.
>>> 2. I eschew ugly syntax.
>>
>> Beauty is subjective, so I guess I can say at this point, go write
>> your own language that is beautiful in your mind.  Good luck.
>>
>
> I am. Thanks.
>
>>>
>>>>
>>>> Note that "inheritance" is actually done exactly this way in C++, by
>>>> putting the derived type at the front of the "derived" type, and
>>>> aliasing all the methods/fields into the derived namespace.
>>>>
>>>> Show me what composition by derivation provides that alias this does
>>>> not.
>>>
>>> Nice syntax.
>>
>> So in other words, you want an aqua-blue bikeshed, when D's is just
>> blue.
>> This will be my last reply to this thread...
>>
>
> Aww, little boy didn't get his way and is going home to cry to mommy.

Grow up.  Steven has done the adult thing and realised your difference of  
opinion is based solely on personal preference, and therefore any argument  
on his part is futile.  You, on the other hand, have resorted to personal  
attacks.. a logical fallacy which typically means lack of self control  
and/or no valid rebuttal to the actual argument.  Way to go.

-- 
Using Opera's revolutionary email client: http://www.opera.com/mail/


More information about the Digitalmars-d mailing list