On Saturday, March 25, 2017 04:57:26 Yuxuan Shui via Digitalmars-d-learn wrote: > I see. I always thought tuple() is a type... > > So a tuple of types is a type, but a tuple of mixed types and > values is not a type. Doesn't seem very consistent.
An AliasSeq isn't really ever a type. AliasSeq!(int, float) is a list of types, not a type itself, and is expressions supports comparing those in at least some instances, because is expressions operate on types, and having them support a list of types is useful. Calling AliasSeq!(int, float) a type would be like claiming that the (int, float) in foo!(int, float) a type. It's a list - a list of template arguments in this case - but it's still a list and not itself a type. An AliaSeq (or tuple as the compiler incorrectly calls it) is essentially a list of symbols or expressions - or aliases - which is why TypeTuple got renamed to AliasSeq; it's not really a tuple (since unlike a tuple, it always expands and is not nestable), and it doesn't hold just types. Also, it's used for template parameters, template arguments, function parameters, and function arguments, so you can't really call it a list of parameters or arguments. So, so it's sort of a list or sequence of aliases, that's what it got changed to - AliasSeq. But that's still not a great name for it. It can just hold too many different things and be used in too many different ways. Essentially though, an AliasSeq is a list of template/function parameters/arguments that happens to be separated from any templates or functions at the moment. In any case, since is expressions are entirely meant for operating on types, having them not work with an AliaSeq that includes values makes sense. In general, mixing types and values in a single AliasSeq isn't a great idea - (though sometimes that's exactly what's required for template arguments). So, code that mixes them is not the norm. > Here is the solution I will go with: > > struct test(T...) { } > import std.range; > static assert (is(test!(expandRange!(iota(0,5))) == test!(0, 1, > 2, 3, 4))); Why are you using is expressons at all? Why are you creating a type? You're dealing purely with values here. As such, why aren't you just using arrays or ranges? At least with your example here, using an AliasSeq is just complicating life. Dynamic arrays and ranges can be used at compile time via CTFE and are a lot more straightforward to use. - Jonathan M Davis