xxxxxxxxxx
import std.stdio;
mixin template namespaced(symbols...)
{
import std.format;
static foreach (i, symbol; symbols)
mixin("alias %s = symbols[%d];".format(__traits(identifier, symbol), i));
}
enum A { X = 1, Y = 2, Z = 3 }
enum B { X = 2, Y = 4, Z = 6 }
mixin namespaced!(A, B) Foo;
mixin namespaced!Foo Bar;
void main()
{
writeln(Foo.A.X + Foo.A.Y + Foo.A.Z);
writeln(Foo.B.X + Foo.B.Y + Foo.B.Z);
writeln(cast(int) Bar.Foo.A.X);
writeln(cast(int) Bar.Foo.B.X);
}