import in mixin template

Era Scarecrow via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed May 25 22:47:36 PDT 2016


On Thursday, 26 May 2016 at 05:20:25 UTC, vitus wrote:
> Why 'alias wln1 = writeln;' doesnt't work but 'alias wln2 = 
> std.stdio.writeln;' work when import is not static? Why 
> 'wln2("test");' work but 'std.stdio.writeln("test");' doesn't? 
> (changing import to static import doesn't change anything)

  The import seems to be localized to just the mixin & the 
template. Makes sense since you don't want to be cluttering the 
namespace with other imports.

  The only thing you haven't shown is that the 'alias m' is 
identified and accessible. Adding it in the compiler doesn't 
complain; Only line 11 (alias wln1) complains for me DMD w32 
v2.071.0.


More information about the Digitalmars-d-learn mailing list