On 3/16/12 8:35 AM, Adam D. Ruppe wrote:
enum Serializable { yes, no }

@note(Serializable.yes) int a;
[...]
foreach(i, exp; __traits(getNotes, a)) {
static assert(is(typeof(exp) == Serializable);
static assert(exp == Serializable.yes);
}

So we have:

class A {
    @note(Serializable.yes) int a;
    ...
}

vs. a hypothetical in-language solution:

class A {
    int a;
    mixin(note("a", Serializable.yes));
    ...
}

I wonder to what extent the in-language solution can be made to work.


Andrei

Reply via email to