Comma operator = broken design

Jonathan M Davis jmdavisProg at
Sun Dec 11 17:25:07 PST 2011

On Sunday, December 11, 2011 20:19:11 Robert Jacques wrote:
> A lot (all?) of for loop use cases seem to actually work in tuple form. For
> instance,
> for(; cond; tuple(++x, y *= 2) ) {}
> Will behave as expected, although there might be a performance issue.

What if one of the expression's result is void?

All in all, I think that it's ludicrous to consider changing the semantics of 
for loops to use a tuple instead of the comma operator. It's one thing to 
consider eliminating the comma operator outside of for loops. It's yet another 
to consider adding built-in templates beyond that, and it's going _way_ too 
far to change the semantics of the for loop as part of that IMHO.

for loops should be left exactly as they are, regardless of what happens with 
the comma operator outside of for loops.

- Jonathan M Davis

More information about the Digitalmars-d mailing list