[Issue 2659] Remove the comma operator

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Feb 28 01:13:01 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=2659



--- Comment #5 from yebblies <yebblies at gmail.com> 2014-02-28 20:13:00 EST ---
(In reply to comment #4)
> vec = overloaded vector type of size 3.
> 
> What I meant to write:
> vec v = vec(0, 0, 3);
> 
> What I actually wrote:
> vec v = (0, 0, 3);
> 
> Result:
> vec v = 3; // as in vec(3, 3, 3);
> 
> It was quite nasty. Considering D doesn't allow statements like 3; I don't see
> why it isn't an error to do it when using the comma operator in an assignment.
> It literally just throws away everything with no side effect.
> 

There was an attempt in the past to error on a commaexp where the non-last
expression has no side effects, but it was never enabled because the compiler
generates thousands of these, screwing everything up.  It will probably be
added eventually.

> Or make it easy and just remove the comma operator completely in its current
> form.

That's the plan, hopefully in 2.066.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list