UDA question

Ulf Johansson ulf.johansson at o-vik.com
Mon Apr 15 23:29:21 PDT 2013


I have a question regarding using a struct value as user-defined 
attribute. The use-case I am trying to get working is as follows:

struct message {
     int atom;
}

...

class AnActor : ... {
     @message(id) void myHandler(string arg1, real arg2) {
     }

     mixin ... // a mixin that builds message dispatch
}


The 'message' attribute defines methods of the class that will 
participate in message dispatch argument matching. This works 
fine but I want to take this one step further. I want to be able 
to give a message and a handler an ID that more strictly directs 
a message (and gives an error if arguments does not match).

The problem I have is quite simple - getting the value of 'atom' 
out of the message attribute. How can I do this? I did not post 
any of my actual code, I hope the above example describes the 
problem.

Regards,
Ulf


More information about the Digitalmars-d mailing list