Named multi-imports

Johnson Jones via Digitalmars-d digitalmars-d at puremagic.com
Thu Aug 17 14:15:25 PDT 2017


On Thursday, 17 August 2017 at 21:03:33 UTC, aberba wrote:
> On Wednesday, 16 August 2017 at 13:57:17 UTC, jmh530 wrote:
>> 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]);
>> }
>
> Its more like this:
>
> import oo = {std.stdio : {writeln, write}, std.algorithm: 
> {filter, map}, …};
>
> oo.writeln();
> oo.write();
> oo.filter(...);
> oo.map(...);

Someone gets it! ;)


More information about the Digitalmars-d mailing list