[Issue 13855] Allow multiple selective imports from different modules in a single import statement

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Mar 14 02:40:40 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=13855

--- Comment #5 from Martin Nowak <code at dawg.eu> ---
Well the point was that imports don't need to be that legible, because they
hardly are relevant during reading.
Java is famous for it's horrible import "manifests", many editors just fold
those blocks.

My main motivation is the following.
Whenever I have the following import (valid today)

import std.file, std.stdio : writeln;

and I need sth., say map, I can either prepend all of std.algorithm or add
another selective import.

void foo(Range r)
{
    import std.file, std.stdio : writeln;
    import std.algorithm : map;

    writeln(r.map!readText);
}

And often import std.algorithm, std.file, std.stdio : writeln; is the much more
concise choice.
Also I'm usually sorting imports, which isn't possible when only the last one
supports selective imports.

--


More information about the Digitalmars-d-bugs mailing list