On 13/5/2016 20:44, Nick Treleaven wrote:
On Thursday, 12 May 2016 at 02:51:33 UTC, Lionello Lunesu wrote:
I'm trying to think of a case where changing a single value into a
tuple with 2 (or more) values would silently change the behavior, but
I can't think of any. Seems to me it would always cause an error, iff
the result of the comma operator gets used.
int x,y;
auto f() {return (x=4,y);}
...
auto z = f();
static if (!is(typeof(z) == int)
voteForTrump();
;-)
In practice, this is more plausible with function overloading - i.e.
z.overload() calling a different function. If the comma operator returns
void, the `auto z` line and f().overload() both fail.
Good point. Thanks.