<div class="gmail_quote">On 9 March 2012 02:26, bearophile <span dir="ltr"><<a href="mailto:bearophileHUGS@lycos.com">bearophileHUGS@lycos.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Manu:<br>
<div class="im">7<br>
> How is any programmer supposed to intuitively assume that returning a tuple<br>
> by value would behave in that way? And how are you supposed to trust it?<br>
> It's an abuse of concept and syntax. It seems like a convolution that could<br>
> only possibly confuse people, they are conceptually quite different things,<br>
> and shouldn't be lumped into the same syntax for my money.<br>
<br>
</div>I am asking for multiple return values in D since some years, so I share your desire. But keep in mind that in D currently there are Phobos Tuples and DMD typetuples. Adding a third type of tuple-like things in a single language sounds a bit excessive. Two kinds of tuples in a language are already too much, in my opinion.<br>
</blockquote><div><br></div><div>This is most certainly NOT a tuple-like thing. I don't think I can stress that point any harder :)</div><div>It is not an object, you can't evaluate it as a whole, you can't iterate it, these values are not connected in ANY way. These are the properties which make the whole concept simpler, and intuitively map to the same concept as passing multiple args TO a function, but in reverse. No tricks, completely intuitive and predictable.</div>
<div><br></div><div>You aren't expected to construct an arg list tuple every time you want to CALL a function, you just line up a sequence of values you get from wherever. Multiple return value assignment should be just as random and flexible; eg, one item stored to memory, one retained as a local (kept in a register with no memory expression), another may be ignored (stripping associated code path)...</div>
</div>