Changing the behavior of the comma operator

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Mar 26 09:19:26 PDT 2014


On Wed, Mar 26, 2014 at 08:24:23AM +0000, Kagamin wrote:
> On Tuesday, 25 March 2014 at 17:58:45 UTC, bearophile wrote:
> >I think total removal of the comma operator could offer more readable
> >D code.
> 
> No, complete removal will make code less readable. Why can't you read
> commas?

Are you talking about the comma *operator*, or are you talking about
commas in general? Please don't confuse the two.

OTOH, the fact that people don't even understand what the comma
operator is, is a good reason to kill it. With extreme prejudice. And
for the sake of those who aren't clear: the comma operator has NOTHING
to do with the following:

	int x,y;
	int[] a = [1,2,3];
	func(a,x,y);
	enum E { A, B, C }

So relax. We're not proposing to get rid of the comma in the whole
language. What we're proposing is to get rid of things like this:

	int x = 1, 5;	// hands up, how many understand what this does?


T

-- 
Leather is waterproof.  Ever see a cow with an umbrella?


More information about the Digitalmars-d mailing list