Changing the behavior of the comma operator
monarch_dodra
monarchdodra at gmail.com
Thu Mar 27 04:52:14 PDT 2014
On Thursday, 27 March 2014 at 11:32:45 UTC, Kagamin wrote:
> On Wednesday, 26 March 2014 at 16:21:01 UTC, H. S. Teoh wrote:
>> What we're proposing is to get rid of things like this:
>>
>> int x = 1, 5; // hands up, how many understand what this does?
>
> This proposal gets rid of this while keeping the comma operator.
The point is that this is not the comma operator, and is already
illegal to begin with.
*This* is what is being made illegal
int x = (1, 5);
The point being that most programmers don't actually understand
all the subtleties of comma operator vs argument listing. Mysielf
included (I also thought that was a comma operator...)
Also, not to mention issues with things like operator
precedence...
a = 1, 5 + 2; //What's a?
a = (1 + 2, 5); //What's a?
Speaking of which:
a = 1, 5 + 2;
Why doesn't dmd emit an "operator , has no effect" error?
Or
a = (1 + 2, 5)
Why doesn't dmd emit an "operator + has no effect" error?
More information about the Digitalmars-d
mailing list