<p><br>
On Mar 9, 2012 10:28 AM, "H. S. Teoh" <<a href="mailto:hsteoh@quickfur.ath.cx">hsteoh@quickfur.ath.cx</a>> wrote:<br>
><br>
> On Fri, Mar 09, 2012 at 03:27:14PM +0100, Timon Gehr wrote:<br>
> > On 03/09/2012 01:23 AM, Manu wrote:<br>
> [...]<br>
> > >int x; ... (x, float y) = func(); // assign to predeclared variable(/s)?<br>
> > >(x, , z) = func(); // ignore the second result value (elimination of the<br>
> > >second result's code path)<br>
> > ><br>
> ><br>
> > Those two would work, but (x,y) = func(); conflicts with the comma<br>
> > operator. (I'd prefer (,) to be a tuple constructor though.)<br>
><br>
> Just out of curiosity, *why* does D have a comma operator? It's one of<br>
> those obscure things about C that can be really, really, nasty if you're<br>
> unaware of it. And C++ makes it worse by making the comma operator<br>
> *overloadable</p>
<p>The comma operator can be worked around by using braces instead.  Of course it is very breaking and quite arguably ugly.</p>
<p>for ({int I; float j;} ; ) ;</p>
<p>But then you have to worry about what it returns.  The sequence operator is actually useful it is just unfortunate that they used it for function parameters also.</p>
<p>I think that the best work around is either the braces which can be quite elegant because it fits the rest of the language and say it returns the return value of the last statement.  Or pick a new character for the sequence operator.</p>

<p> This is actually kinds nice because you get "tuple" in "tuple" out.  Of course they don't need to be tuples that can be passed around they can be values that must be unpacked right away.<br>
</p>