On Wednesday, 16 August 2017 at 10:12:01 UTC, Joel Nilsson wrote:
On Tuesday, 15 August 2017 at 21:12:24 UTC, jmh530 wrote:

In the past, I've thought it would be convenient to have something like

import io = std.stdio : writeln, write;

and allow someone to write

io.write("foo");
io.writeln("bar");


This is already in the language: http://dlang.org/spec/module.html#renamed_imports

Well I knew that renamed imports were allowed, but I didn't realize you could do re-named selective imports (the " : writeln, write" part of it). I just double-checked and it worked. I don't recall it working in the past.

I see that there's an example in the spec, but it is a little more complicated than my example.

Reply via email to