On Monday, 19 August 2013 at 23:55:32 UTC, Meta wrote:
On Monday, 19 August 2013 at 23:48:36 UTC, Meta wrote:
...
An addendum:
void main()
{
//Prints 1
writeln(func(TypeTuple!(1, 2)));
}
int func(int i, int j)
{
return i;
}
This is bad and should never be allowed with some hypothetical
tuple literal syntax. The desired behaviour is:
void main()
{
//Error: func is not callable using argument types (#(int,
int))
writeln(func(#(1, 2));
}
*Unless* you use .expand/[] (pick your poison):
void main()
{
writeln(func(#(1, 2).expand)); //Or #(1, 2)[]
}
No. No. Absolutely no. What you want is simply syntax sugar for
std.typecons.Tuple - it is not worth any language change,
contrary to semantical issues with built-in tuples.
Auto-expansion and integration with function/template parameter
lists is what makes D built-in tuple that useful and it should
stay so with hypothetical tuple literals.