Why can't structs be derived from?

Nick Sabalausky a at a.a
Fri Mar 18 07:09:23 PDT 2011


"Bekenn" <leaveme at alone.com> wrote in message 
news:ilv2pd$1vkd$1 at digitalmars.com...
> On 3/17/2011 2:36 PM, Andrei Alexandrescu wrote:
>>
>> I'm with y'all too. Even Walter needs to stop and think for a second.
>> We're considering enabling
>>
>> alias a = b;
>>
>> as an equivalent for
>>
>> alias b a;
>>
>
> Along similar lines (hoping this isn't too far off-topic), what's the 
> current plan for typedef?  I'm aware that it's deprecated (and for good 
> reason), but some of my reading suggests that there's a successor on the 
> horizon.

I was thinking of asking about that, too. Specifically, would it make sence 
for "typedef b a;" (or "typedef a = b;") to be lowered to something like:

struct a
{
    b _tmp;
    alias _tmp this;
}

Hmm, then again, IIUC, that would allow 'a' to be implicity converted to 'b' 
which would defeat half the point, so maybe not.




More information about the Digitalmars-d mailing list