How to avoid multiple spelling `import`
Joy-Killer via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Jun 16 23:56:54 PDT 2015
On Tuesday, 16 June 2015 at 12:41:14 UTC, Daniel Kozák wrote:
> 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));
> }
just a word to say that while it's working, anyone who uses this
shouldn't expect the tools, i particularly think to DCD, to work
anymore with this. e.g jump to definition...show
ddoc...completion won't work.
More information about the Digitalmars-d-learn
mailing list