import strangeness with std.stdio.write

psychoticRabbit meagain at meagain.com
Tue Feb 13 14:12:27 UTC 2018


On Tuesday, 13 February 2018 at 13:57:38 UTC, ketmar wrote:
> `std.file` has function named `write()` too. and local import 
> completely shadows global imports (i.e. it removes global 
> imports from overload set for the given scope), hence 
> `std.stdio.write()` is not available there.

"..local import completely shadows global imports"

oh... I didn't realised imports are subject to scope rules in 
that way.

This new knowledge will certainly prevent some ongoing confusion 
;-)

thanks.

Also, if I do this below, how does the compiler choose the 
correct write function?

import std.stdio;
import std.file;

void main()
{
     write("hello");
     writeln("hello again");
}



More information about the Digitalmars-d-learn mailing list