On Tue, 16 Jun 2015 11:45:22 +0000 Dennis Ritchie via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote:
> Maybe not everyone needs these features. But, unfortunately, I > often use a lot of imported modules. And use every time the word > `import` very bad. > > version (none) { > import std.math, > std.conv, > std.stdio, > std.ascii, > std.range, > std.array, > std.regex, > std.format, > std.bigint, > std.traits, > std.random, > std.string, > std.numeric, > std.variant, > std.typecons, > std.container, > std.algorithm, > std.typetuple, > std.exception, > core.checkedint; > } > > I just want to import individual features of these modules. mixin template include(w...) { mixin _include!(w.length - 1, w); } mixin template _include(long N, i...) { mixin("import " ~ i[N] ~ ";"); mixin _include!(N - 1, i); } mixin template _include(long N : 0, i...) { mixin("import " ~ i[N] ~ ";"); } mixin include!( "std.stdio : writeln, write", "std.conv : to" ); void main() { writeln(to!string(7)); }