Multiple selective imports on one line

Joakim via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Dec 28 06:09:30 PST 2015


On Wednesday, 23 December 2015 at 10:51:52 UTC, earthfront wrote:
> I'm using hackerpilot's excellent textadept plugin + DCD, Dfmt, 
> and Dscanner.
> Upon saving files, it produces suggestions, much like warnings 
> from the compiler.
>
> One suggestion is to use selective imports in local scopes. OK, 
> I'll do that.
>
> Now I'm left with a smattering of lines which are just 
> selective imports from a single module:
> void foo()
> {
>   import std.exception:enforce;
>   import std.algorithm:array;
>   import std.algorithm.iteration:filter;
>   import std.functional:memoize;
>
>   //..Work..
> }
>
> What is the proper way to combine these into one line?

You really shouldn't have to do this by hand.  I wish dfmt could 
do this for us, so that you develop with all the modules imported 
at the top, then run dfmt and it scopes all the imports and adds 
the selective import of symbols.  I've been thinking about 
implementing a tool to do this myself, will get around to it 
someday.


More information about the Digitalmars-d-learn mailing list