<div class="gmail_quote">On 9 March 2012 02:59, Mantis <span dir="ltr"><<a href="mailto:mail.mantis.88@gmail.com">mail.mantis.88@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
09.03.2012 2:23, Manu пишет:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 9 March 2012 01:56, Mantis <<a href="mailto:mail.mantis.88@gmail.com" target="_blank">mail.mantis.88@gmail.com</a> <mailto:<a href="mailto:mail.mantis.88@gmail.com" target="_blank">mail.mantis.88@gmail.<u></u>com</a>>> wrote:<br>

<br>
    [...]<div class="im"><br>
    Is tuple required to be anonymous struct? I thought it's<br>
    implementation details that may be done the other way if tuples<br>
    implemented in language rather then library. There's another<br>
    problem with non-named return values, as this:<br>
    auto (sin_a, cos_a) = sincos( a );<br>
    is not equivalent to this:<br>
    auto (cos_a, sin_a) = sincos( a );<br>
<br>
<br>
I can't imagine a syntax that's non-destructive to the existing grammar where order is not important, but order would be clearly stated in the auto-complete pop-up, and in the reference. Also mismatching types would throw errors.<br>

</div></blockquote>
<br>
You can't mess with the parameters order in this case: <a href="http://dl.dropbox.com/u/36715190/Images/par_order.jpg" target="_blank">http://dl.dropbox.com/u/<u></u>36715190/Images/par_order.jpg</a><br>
Is it impossible to make efficient multiple return values without the need to trade off the help from tools?<br>
</blockquote></div><div><br></div>Eh? How so?<div><br><div>Visual studio show's the return value and function name in the same tooltip (not just the argument list as your image shows). Tools may need to tweak their popup if they don't present the return values already.</div>
<div>Also, tools can do the usual red-squiggly underline thing on return assignments with mismatching result count or types easily.</div></div><div><br></div><div><br></div><div>On 9 March 2012 03:24, bearophile <span dir="ltr"><<a href="mailto:bearophileHUGS@lycos.com">bearophileHUGS@lycos.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">I understand. But in other languages tuples are used for such purpose, so there is some risk people will think of them as a third kind of tuples, despite they are a different thing.<br>
</blockquote><div><br></div><div>I really don't think so. The only language I know of that behaves like you say is lua (oh, and python?); scripting languages, not too interested with ABI expression, and bear virtually no relation whatsoever to any c-like language.</div>
<div>I think the comparison might be drawn to something more like Go. Octave does it with an interesting syntax, but these are not compatible with D in a non-breaking way.</div><div><br></div><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
What kind of syntax do you suggest?<br></blockquote><div><br></div><div>I detailed my initial idea in my post prior to yours, but perhaps other more interesting syntax might also exist:</div><div><br></div><div><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div>I imagine something like:<br></div><div>auto (x, y) = func(); // specify auto for all results?</div><div>float (x, y) = func(); // specify explicit type for all results?</div><div>(int x, float y) = func; // explicitly type each result?</div>
<div>int x; ... (x, float y) = func(); // assign to predeclared variable(/s)?</div><div>(x, , z) = func(); // ignore the second result value, intuitive and visible (elimination of the second result's code path)</div><div>
<br></div><div>I'm sure other more bizarre syntax could be possible too to help reduce bracket spam. Ideas from things like lambda syntax?</div></blockquote></div><br class="Apple-interchange-newline"></div>