Generating code based on UDA

Rares Pop via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Oct 25 06:37:54 PDT 2014


Hello everyone,

I am trying to understand UDA traits scoping while mixing in code.
Aiming to generate code based on UDA I wonder if the following is 
possible:

class A
{
    @Inject
    Logger logger;

    @Inject
    SomeOtherClass dependency;

    mixin injections!(A)

...
}

In "injections" function I want to iterate through members 
annotated with the @Inject attribute and generate some specific 
code.
So far in my attempts the compiler complains about unknown 
identifier A.
Should the A class be available to the compiler at the time of 
the mixin invocation?

Thanks for your help,
Rares


More information about the Digitalmars-d-learn mailing list