Named multi-imports

jmh530 via Digitalmars-d digitalmars-d at puremagic.com
Thu Aug 17 16:25:59 PDT 2017


On Thursday, 17 August 2017 at 21:49:38 UTC, Timon Gehr wrote:
>
> private struct oo{
>     import std.stdio: writeln, write;
>     import std.algorithm: filter, map;
>     // …
> }
>
> void main(){
>     oo.write("result: ");
>     
> oo.writeln(oo.map!(x=>x/2)(oo.filter!(x=>x%2==0)([1,2,3,4,5,6,10])));
> }

Would not have thought to do that! Very cool.

Quick follow up: is there a reason this why renamed selective 
imports don't work this way? As in the bug from the link below we 
discussed above

https://issues.dlang.org/show_bug.cgi?id=17756

Re-writing the import like this seems like the perfect bug fix?


More information about the Digitalmars-d mailing list