psychoticRabbit wrote:

So, strange problem below.

The commented-out line will not compile (if I un-comment it), unless I either move std.stdio into main, or, move std.file out of main.

Whereas writeln works just fine as is.

module test;

import std.stdio;

void main()
     import std.file;

     writeln("hello again");

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

this is done by purpose, so your code won't accidentally use wrong function. you can bring `std.stdio` functions back by adding local `import std.stdio;`, for example.

Reply via email to