I really like the idea of annotations to use in traits 
(compile-time-pseudoreflection).

I have the following code:
http://code.google.com/p/pspemu/source/browse/trunk/src/pspemu/hle/kd/rtc/sceRtc.d

Each function has associated a NID. And I have to specify the NID outside, 
repeating the name of the function and creating a method for that.

Now I have to do:

void initNids() {
    mixin(registerd!(0xC41C2853, sceRtcGetTickResolution));
}

u32 sceRtcGetTickResolution() {
//...
}

And with custom attributes/annotations I could do something like this:

struct NID {
    uint nid;
}

[NID(0xC41C2853)]
u32 sceRtcGetTickResolution() {
//...
}

And then with traits: allMembers + get custom attributos from each member. The 
function name only appears once, and the NID appears near the implementation.

Reply via email to