User Defined Attributes

Adam D. Ruppe destructionator at gmail.com
Tue Nov 6 07:29:53 PST 2012


On Tuesday, 6 November 2012 at 15:18:55 UTC, Walter Bright wrote:
> I don't know what use UDAs would be for parameters.

It's pretty much the same as anywhere else: to add useful data 
for reflection. A few I'd use it for is providing user visible 
data like label and hint for automatic UI generation, or styling 
hints again for the auto ui (e.g. "use a multi-line input for 
this string").

We could also potentially put validation in there, though this 
may be on the type as well. Or put on info to check for 
availability of a username.


If you do an automatic UI generator, attributes on the parameters 
have a lot of uses. Other than that, well, I don't know, but 
that's probably just because I haven't done it yet!


More information about the Digitalmars-d-announce mailing list