Comma operator = broken design

Robert Jacques sandford at jhu.edu
Thu Dec 8 17:12:07 PST 2011


On Thu, 08 Dec 2011 12:18:56 -0500, Joshua Reusch <yoschi at arkandos.de> wrote:>
>> Ahem. So are you suggesting that (a,b) means a tuple everywhere but in a
>> for loop, where it is used to separate two statements?
>
> If we use the comma operator only for tuples, there needn't to be a
> special case for loops:
>
> for(x, y = 0 , 100; x < y ; x, y += 1,-1) { ... }
>
Clever! However,
1) Showing that the trivial example can be expressed with tuples is a good first step. The next step is to go after some of the advanced comma usages. i.e. What's the limitations of this approach? When does it break down?
2) As per the current tuple proposals, the above is a horrendous performance sink. Granted, more tuple awareness in the compiler might fix the problem, but that awareness is more than what's in the current tuple proposals.
 


More information about the Digitalmars-d mailing list