Why not mixin "int a;" ??

Jarrett Billingsley kb3ctd2 at yahoo.com
Sun Aug 24 07:54:02 PDT 2008


"Tomasz Sowiñski" <tomeksowi at gmail.com> wrote in message 
news:g8rnkc$1fj5$1 at digitalmars.com...
>I can mixin templates without parens, like this:
> mixin foo!(int);
>
> So why can't I do this:
> mixin "int a;";
> instead of this:
> mixin("int a;");
> ?
>
> Seems a bit inconsistent to me, but maybe I don't see the reason...
>
> Tomek

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.. 




More information about the Digitalmars-d-learn mailing list