Named multi-imports

Johnson via Digitalmars-d digitalmars-d at puremagic.com
Wed Aug 16 06:44:55 PDT 2017


On Wednesday, 16 August 2017 at 09:54:41 UTC, aberba wrote:
> On Tuesday, 15 August 2017 at 21:12:24 UTC, jmh530 wrote:
>> On Tuesday, 15 August 2017 at 20:33:18 UTC, Johnson wrote:
>>>>
>>>> Or instead of a new language feature, the gtk-d guys could 
>>>> have package files ;)
>>>
>>> But then that only helps with one specific instance. D is 
>>> full of language features, I do not see why everyone is so 
>>> against them. Without them, D would be empty, nothing, and no 
>>> one would use it. Adding language features should be see as 
>>> something good, cause without them, we wouldn't get anywhere.
>>
>> In the past, I've thought it would be convenient to have 
>> something like
>>
>> import io = std.stdio : writeln, write;
>>
>> and allow someone to write
>>
>> io.write("foo");
>> io.writeln("bar");
>>
>> though I don't know if that causes any kinds of problems to 
>> implement.
>
> This looks really clean for code modularity.
>
> import io = std.stdio : {writeln, write}, ...

Yes, and also

import io = {std.stdio : {writeln, write}, ... }

which allows one to create their own "packages" inline. Group the 
best functionality they use often. Should be quick, efficient, 
and easy to implement. D should have this, where do I vote for it?



More information about the Digitalmars-d mailing list