Multiple selective imports on one line
ZombineDev via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Dec 23 13:52:33 PST 2015
On Wednesday, 23 December 2015 at 19:27:31 UTC, earthfront wrote:
> On Wednesday, 23 December 2015 at 11:12:22 UTC, ZombineDev
> wrote:
>> Actually array() is from sts.array and correct way to use
>> selective imports is:
>> import std.exception : enforce;
>> import std.array : array;
>> import std.algorithm.iteration : filter;
>> import std.functional : memoize;
>>
>> If you want to import several symbols from one module, you can
>> list them after the column like so:
>> import std.algorithm : any, find, sort /*, etc... */;
>
> I hadn't compiled yet, so the array thing is indeed an error.
> So there's no way to combine these _selective_ imports on a
> single line, like I can with regular _module_ imports:
> import std.exception, std.array, std.functional;
>
> Correct?
Yes, it is not allowed by the grammar. I think the reason is that
the list items would become ambiguous (the difference between
selected symbols and module names could only be revealed after
semantic analysis). See for example:
import abc : cba, dcb, bca : acb, dbc;
// What is dbc? A module or a member of bca?
More information about the Digitalmars-d-learn
mailing list