Why do template mixins have their own scope?
Timon Gehr
timon.gehr at gmx.ch
Sat Jul 16 11:41:37 PDT 2011
Trass3r wrote:
> I guess this is the cause for
> http://d.puremagic.com/issues/show_bug.cgi?id=3332
> It makes it practically impossible to mixin constructors because overload
> resolution doesn't work.
mixin template foo(){
immutable x = 1;
int bar(){return x;}
}
immutable x = 2;
mixin foo!();
void main(){assert(bar == 1);}
Cheers,
-Timon
More information about the Digitalmars-d
mailing list