On Saturday, 12 December 2015 at 11:00:17 UTC, Shriramana Sharma
wrote:
Hello. By executing the following:
alias AS = AliasSeq!(int, double);
int foo(AS td) // same as int foo(int, double);
{
writeln(typeof(td).stringof);
return td[0] + cast(int)td[1];
}
I get:
(int, double)
But it is not very clear as to what exactly the type of `td`
is! I understand that the AliasSeq is presented to the function
body *as if* it were a Tuple!(int, double) in that it can be
accessed using [0] [1] etc, but it is not *really* (in the
sense of RTTI) a Tuple, is it? In which case, what is it? Is it
another "Voldemort" type?
An AliasSeq is a sequence of types that exist only at
compile-time, hence I see two possible answers to your question.
The first is that it is what you told it to be: a sequence of two
elements, first int then double. From the compiler point of view
that's what it is. If you look from a runtime point of view
though there is no one type for td: it's only a game of symbols
and as td by itself doesn't even have a size one could argue that
it doesn't have a type at all. That's because it doesn't exist at
all at runtime (there is only int and double).
So, no, it's not a Voldemort type, it's exactly what the compiler
tells you it is: the sequence of types (int, double).