So you're saying that UDAs are mutable after all? You can change a UDA but you can't add a new one, right? If that's the case, it will solve ALL my problems. I'll have all types marked with my struct and BAM! I have mutable compile-time variables, which I solely needed.


On Wed, Nov 28, 2012 at 1:10 AM, Walter Bright <newshound2@digitalmars.com> wrote:
On 11/27/2012 10:27 PM, Gor Gyolchanyan wrote:
I think I really don't know what exactly do the UDAs do at the moment,
judging from your reply.The only documentation was the original
D.anounce post of yours. Is there a way I can get a reliable
documentation on this?

Use cases:

1. I have a declaration with a UDA struct. I introspect the types I need
and add their names to an array in that struct. read that struct in a
static constructor and do necessary stuff with all those types. Is this
possible currently?

Yes.



2. I have some code, which must be run on any type, marked with a
special UDA. Can I have that code executed without explicitly having to
mix stuff in every module?

It'll either have to be explicitly mixed in with every module that uses the UDA or some other code you write will explicitly need to apply it to each module that uses it. I suggest the former would be more convenient. Note that if a module is to use a UDA, you'll have to edit it anyway, so it shouldn't be a big issue to add the mixin.




--
Bye,
Gor Gyolchanyan.