On 05/24/2016 06:22 PM, Edwin van Leeuwen wrote:
That's what I assumed at first.. So why does the following fail with: cannot interpret double at compile time? I assumed staticMap would automatically flatten the resulting AliasSeqs.``` import std.meta : AliasSeq, ApplyLeft, staticMap; struct Point { double x; double y; } template addType(T,alias name) { alias addType = AliasSeq!( typeof(__traits(getMember, Point, name)), name ); } alias test3 = addType!( Point, "x" ); // I expected AliasSeq!(double,"x")??? pragma(msg,test3); // tuple((double), "x") //static assert(is(test == AliasSeq!(double,"x"))); alias ts = AliasSeq!("x","y"); alias addTypeP = ApplyLeft!(addType,Point); alias mapped = staticMap!(addTypeP,ts); pragma(msg,mapped); void main() { } ```
Seems to be a problem in ApplyLeft: ---- import std.meta: AliasSeq, ApplyLeft; alias addType(T, string name) = AliasSeq!(T, name); alias addTypeInt = ApplyLeft!(addType, int); alias FullyInstantiated = addTypeInt!"foo"; ---- Fails with: "std/meta.d(1114): Error: cannot interpret int at compile time". I've filed an issue: https://issues.dlang.org/show_bug.cgi?id=16070 [...]
I thought so, but a lot of the documentation does seem to compare it (see the example here): https://dlang.org/library/std/meta/static_map.html
Using `is(...)` with an AliasSeq of only types is ok. But you can't use it when there's a non-type in the sequence.
