User Defined Attributes

Jonathan M Davis jmdavisProg at gmx.com
Tue Nov 6 12:58:16 PST 2012


On Monday, November 05, 2012 23:55:49 Walter Bright wrote:
> UDA's can be extracted into an expression tuple using __traits:
> 
> [ 'c' ] string s;
> pragma(msg, __traits(getAttributes, s));
> 
> prints:
> 
> tuple('c')
> 
> If there are no user defined attributes for the symbol, an empty tuple is
> returned. The expression tuple can be turned into a manipulatable tuple:
> 
> template Tuple(T...) {
> alias T Tuple;
> }

Wait. That's a TypeTuple. Tuple is completely different. You're going to create 
serious confusion here if you call it Tuple. Tuple is in std.typecons. And 
we've already seriously discussed renaming TypeTuple to something else because 
it doesn't hold just types and because it really doesn't act like a tuple (if 
it were really a tuple, it wouldn't auto-expand). The idea here may be good, 
but the terminology used is going to cause a lot of confusion.

- Jonathan M Davis


More information about the Digitalmars-d-announce mailing list