The future of UDAs.

Walter Bright newshound2 at digitalmars.com
Tue Nov 27 13:10:55 PST 2012


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.



More information about the Digitalmars-d mailing list