Template Mixin Conflicts
Ali Çehreli via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Oct 6 10:33:13 PDT 2014
On 10/06/2014 05:50 AM, ketmar via Digitalmars-d-learn wrote:
> On Mon, 06 Oct 2014 12:17:00 +0000
> Alice via Digitalmars-d-learn <digitalmars-d-learn at puremagic.com> wrote:
>
> the joy of mixin bugs, yeah! it's a bug in compiler: it instantiates
> mixin in invalid scope. for now you can use string mixins, they are
> working fine.
>
> you also can use this to fix scoping:
>
> === ModuleA.d ===
>
> module ModuleA;
> static import ModuleB;
> mixin ModuleB.MixinUsefulStuff;
> pragma(msg, "a = ", SomeData.a);
>
> btw, do you mind to fill a bugreport?
>
Another workaround is to mixin into a scope and then bring the names out
by alias. Doing the following in both files works:
struct MixinUsefulStuffWrapper
{
mixin MixinUsefulStuff;
}
alias SomeData = MixinUsefulStuffWrapper.SomeData;
Ali
More information about the Digitalmars-d-learn
mailing list