A Discussion of Tuple Syntax
Meta
jared771 at gmail.com
Mon Aug 19 17:14:28 PDT 2013
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?
}
More information about the Digitalmars-d
mailing list