On Thursday, 25 August 2016 at 14:43:35 UTC, Dominikus Dittes Scherkl wrote:


But I dislike the named tuple members.
Why not declare them at the calling site?

(int, int, int, string) fn()
{
   return (3, 2, 1, "meins");
}

int x, y, z;
string s;
(x, y, z, s) = fn();

This is possible:

"
(string, string, string) LookupName(long id) // tuple return type
{
    ... // retrieve first, middle and last from data storage
    return (first, middle, last); // tuple literal
}

...

"You can also deconstruct into existing variables with a deconstructing assignment:

(first, middle, last) = LookupName(id2); // deconstructing assignment"

Reply via email to