Voting: std.logger

Dicebot via Digitalmars-d digitalmars-d at puremagic.com
Fri Aug 1 09:00:59 PDT 2014


On Friday, 1 August 2014 at 15:31:39 UTC, Martin Nowak wrote:
> Exactly, that's the problem. They collide, so when import both 
> the hijack protection will error.
>
> import std.stdio, std.log;
>
> write("foobar"); // matches both std.stdio.write and 
> std.log.write
>
> It'd also make it more difficult to tell what `write("foobar")` 
> does,
> which is unacceptable for such a fundamental operation.

Solution is easy - don't do `import std.log` an don't recommend 
use to do it in docs, always use `import log = std.log`. This is 
how D module system is supposed to work.

Right now there two conflicting statements in language docs:
1) namespaces are not needed, modules should work as replacement
2) usage of plain imports is encouraged

Pretending that (1) is true and at the same time putting 
namespace workaround to the library is just lying to the 
programmers. Either we need to encourage programming style that 
works with D module system or admit it has completely failed. It 
is a problem not unique to std.logger


More information about the Digitalmars-d mailing list