Hi,
I've created a template mixin which contains a struct definition.
The template is meant to be mixed into each module - to provide a
little bit of auto generated info in each module - generated at
compile time. As soon as I reference the symbols in any context,
it starts complaining about conflicts between the two modules.
It doesn't have to be a struct; the conflicts exist whether I
define a struct, class, function, or whatever... any symbol.
It is valid to manually define symbols with the same name in
different modules, since they each exist in a different scope, so
why does a symbol brought in by a mixin conflict?
Even defining the struct as private doesn't help. Any ideas would
be most appreciated.
Here's a very simple failing case:
// ModuleA.d
module ModuleA;
import ModuleB;
mixin MixinUsefulStuff;
pragma(msg, "a = ", SomeData.a); // Error:
ModuleB.MixinUsefulStuff!().SomeData at ModuleB.d(5) conflicts
with ModuleA.MixinUsefulStuff!().SomeData at ModuleB.d(5)
// ModuleB.d
module ModuleB;
mixin template MixinUsefulStuff()
{
struct SomeData
{
enum a = 123;
}
}
mixin MixinUsefulStuff;