digitalmars.D - UDA tuple flattening
- jerro (21/21) Dec 18 2012 I noticed that this doesn't work with the latest DMD from github:
- Max Samukha (2/24) Dec 18 2012 Definitely a bug.
I noticed that this doesn't work with the latest DMD from github: import std.typetuple; struct Foo{} struct Bar{} alias TypeTuple!(Foo, Bar) FooBar; FooBar void foo(){} pragma(msg, __traits(getAttributes, foo)); When trying to compile this, the compiler prints: a.d(6): Error: cannot form tuple of tuples tuple(((Foo, Bar))) Would it not make sense for the tuples of attributes to be automatically flattened, as tuples are in other places? This would also allow one to do stuff like this, which I think could be very useful: static if(something) alias TypeTuple!(A, B, C) fooAttributes; else alias TypeTuple!(C, D) fooAttributes; fooAttributes void foo(){}
Dec 18 2012
On Tuesday, 18 December 2012 at 17:31:49 UTC, jerro wrote:I noticed that this doesn't work with the latest DMD from github: import std.typetuple; struct Foo{} struct Bar{} alias TypeTuple!(Foo, Bar) FooBar; FooBar void foo(){} pragma(msg, __traits(getAttributes, foo)); When trying to compile this, the compiler prints: a.d(6): Error: cannot form tuple of tuples tuple(((Foo, Bar))) Would it not make sense for the tuples of attributes to be automatically flattened, as tuples are in other places? This would also allow one to do stuff like this, which I think could be very useful: static if(something) alias TypeTuple!(A, B, C) fooAttributes; else alias TypeTuple!(C, D) fooAttributes; fooAttributes void foo(){}Definitely a bug.
Dec 18 2012