Can't access enum from a different module when it was generated by a string mixin.

FeepingCreature feepingcreature at gmail.com
Mon Mar 31 14:59:21 UTC 2025


On Monday, 31 March 2025 at 13:24:11 UTC, realhet wrote:
> Hello,
>
> I have a module with an enum declaration: `module a; enum 
> E:ubyte{ e1, e2 }`
>
> I can import it into a different module: `module b; import a : 
> E;`
>
> But if I generate the enum with a string mixin: `module a; 
> mixin(q{enum E:ubyte{ e1, e2 }});`
>
> I get an error: module `a` import `E` not found.
>
> My question is: Why? And how to fix it? It prevents me from 
> splitting into smaller modules.
>
> These are just metadata, I don't want to use static immutable 
> arrays, an enumerated tyope would be perfect.  And it's a 
> string mixin because I automatically generate it from an 
> 'excel' table.
>
> Thank You in advance!

Can you give a repro? It works here.


More information about the Digitalmars-d-learn mailing list