Places a TypeTuple can be used

Dicebot public at dicebot.lv
Fri Aug 16 09:02:03 PDT 2013


On Friday, 16 August 2013 at 15:40:35 UTC, Ali Çehreli wrote:
> Exactly. Only then this concept would be easy to understand and 
> explain. It would make "a comma-separated list of 
> expressions/types" a language construct. Done.

It does complicate things that sometimes TypeTuple is accepted in 
cases where comma-separated list does not:

import std.typetuple;

void main()
{
     //alias TT = TypeTuple!(int, string);
     //TT twoVars;
     (int, string) twoVars; // do you expect this to work?
     static assert(is(typeof(twoVars[0]) == int));
     static assert(is(typeof(twoVars[1]) == string));
}

The fact that built-in concept of tuple can't be expressed with 
built-in syntax creates lot of learning issues. In that regard, 
defining "list of expressions/types" as language construct goes 
as a solution both ways.

I honestly think it is one of the cases where idea "wow, we can 
have library support for type tuples instead of language 
support!" has failed with an enormous technical debt.


More information about the Digitalmars-d-learn mailing list