let (x,y) = ...

karabuta via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Mon Nov 23 01:30:03 PST 2015


On Friday, 20 February 2015 at 09:12:26 UTC, Jacob Carlborg wrote:
> On 2015-02-19 05:38, thedeemon wrote:
>> Creating tuples and returning them from functions is trivial 
>> in D:
>>
>> auto getTuple() { return tuple("Bob", 42); }
>>
>> but using them afterwards can be confusing and error prone
>>
>> auto t = getTuple();
>> writeln("name is ", t[0], " age is ", t[1]);
>>
>> I really missed the ML syntax to write
>>
>> let (name, age) = getTuple();
>
> Didn't someone create a pull request for something like:
>
> auto(name, age) = getTuple();
>
> Or was it a DIP?

Waw! auto(name, age) = getTuple(); looks better :)


More information about the Digitalmars-d-announce mailing list