User Defined Attributes

Jakob Ovrum jakobovrum at gmail.com
Tue Nov 6 00:49:42 PST 2012


On Tuesday, 6 November 2012 at 08:42:44 UTC, Walter Bright wrote:
> Since D allows one to inquire and get a list of symbols, one 
> can then iterate over them at compile time to determine which 
> are serializable (or have some other specific attribute).

Yes, but somewhere you have to put startup code pointing in the 
general direction of where the attributes are used (like a 
module), it's not automatic. A static constructor cannot be used 
because it has no idea where to look.

But, I yield until someone comes up with actual examples of how 
these UDAs are useful, because I can't think of anything 
interesting at the moment. I guess I should go read over the old 
discussions you linked (I remember participating, but can't 
remember any specifics).




More information about the Digitalmars-d-announce mailing list