Multiple selective imports on one line

earthfront via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Dec 23 11:34:26 PST 2015


On Wednesday, 23 December 2015 at 11:00:19 UTC, Jakob Ovrum wrote:
> On Wednesday, 23 December 2015 at 10:51:52 UTC, earthfront 
> wrote:
>> Now I'm left with a smattering of lines which are just 
>> selective imports from a single module:
>>   import std.exception:enforce;
>>   import std.algorithm:array;
>>   import std.algorithm.iteration:filter;
>>   import std.functional:memoize;
>>
>> What is the proper way to combine these into one line?
>
> There's no `array` in std.algorithm, and I don't see more than 
> one import per module in your example, but I'm guessing what 
> you want is:
>
> import mod : a, b, c; // import a, b and c from mod

Sorry, no, I didn't want that. I should have typed above:
"I'm left with lines which are selective imports from various 
modules."

My goal is to import several symbols from different modules on 
one line.
I'm trying to figure out if it's possible or not. It makes the 
code more concise in some cases.


More information about the Digitalmars-d-learn mailing list