Why not mixin "int a;" ??

BCS ao at pathlink.com
Sun Aug 24 16:19:31 PDT 2008


Reply to Tomasz,

> Jarrett Billingsley Wrote:
> 
>> mixin foo;
>> 
>> This is now grammatically ambiguous.  If foo is a const char[], then
>> it's a string mixin.  If foo is a template, then it's the same as
>> "mixin foo!();". This could be disambiguated later, but..
>> 
> Is there a difference in what happens when you mixin a template and a
> string? I still don't see why this distinction is necessary.
> 
> Tomek
> 

template Foo()
{
   static const char[] Foo = "int a;"
}

mixin Foo;

did that add a var named a or a const named Foo?




More information about the Digitalmars-d-learn mailing list