Named multi-imports

jmh530 via Digitalmars-d digitalmars-d at puremagic.com
Wed Aug 16 06:57:17 PDT 2017


On Wednesday, 16 August 2017 at 09:54:41 UTC, aberba wrote:
>
> This looks really clean for code modularity.
>
> import io = std.stdio : {writeln, write}, ...

What does this add? A line like below would be confusing.
import io = std.stdio : {writeln, write}, writefln;

The following code compiles and the imports are less confusing.

import io = std.stdio : writeln, write;
import std.stdio : writefln;

void main()
{
     io.write("foo");
     io.writeln("bar");
     writefln("My items are %(%s %).", [1,2,3]);
}


More information about the Digitalmars-d mailing list