Why do template mixins have their own scope?

Trass3r un at known.com
Sat Jul 16 18:13:08 PDT 2011


Am 16.07.2011, 20:41 Uhr, schrieb Timon Gehr <timon.gehr at gmx.ch>:

> 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