I combined a re-named import with a selective import and was
surprised to find that it didn't do what I would have expected.
In the code below, I would have expected only the "test2" line to
have compiled, but it turned out that all three of these do. I'm
guessing the logic is that it imports all of std.stdio, re-names
it as io, then puts just std.stdio.writeln in the namespace.
import io = std.stdio : writeln;
void main()
{
writeln("test1");
io.writeln("test2");
io.write("test3", '\n');
}
It seems like it might be a bit more intuitive if they had
disabled selective imports with re-named imports (like with
static imports). Then you could do a separate selective import.
This would probably be more clear.
As far as I can tell, if you do selective imports of a function
with the same name from two different modules, then you have to
give one a unique name without any module prefix. For instance, I
tried to import with
import std.stdio : writeln, io.writeln = writeln;, but that
doesn't work, but something like io_writeln would.