On 8/19/13 5:14 PM, Meta wrote:
On Tuesday, 20 August 2013 at 00:03:48 UTC, Andrei Alexandrescu wrote:
On 8/19/13 4:48 PM, Meta wrote:
I don't necessarily want built-in syntax for a library type, but making
tuples first-class would be nice. I mean, it's a bummer that they can't
be returned from functions. That should definitely be changed.
return tuple(1, "a");
That's not a TypeTuple, though, it's a built-in tuple.
void main()
{
writeln(func());
}
TypeTuple!(int, string) func()
{
return tuple(1, "a"); //Error
}
Nor does it work the other way around:
Tuple!(int, string) func()
{
return TypeTuple!(1, "a"); //Error
}
How would this work for some hypothetical built-in syntax?
#(int, string) func()
{
return tuple(1, "a"); //Error?
}
Why would it be necessary to return an object of type TypeTuple (i.e.
template tuple)? It has no state.
Andrei