On Tuesday, 16 June 2015 at 12:41:14 UTC, Daniel Kozák wrote:

On Tue, 16 Jun 2015 11:45:22 +0000
Dennis Ritchie via Digitalmars-d-learn
<digitalmars-d-learn@puremagic.com> wrote:
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));
}

Thanks. Maybe I'll use this code in your own programs.

I still believe that this design deserves existence in D:
https://issues.dlang.org/show_bug.cgi?id=14704

Reply via email to