On Wed, Dec 24, 2008 at 5:24 PM, Yigal Chripun <[email protected]> wrote: > why not replace the current comma operator with tuple support? > the comma op needs to be higher than assingment in precedence and instead of > evaluating the expressions left to right and returning the value of the > _last_ expression as the return value of the op, return _all_ expressions' > return values as a value tuple. the current behavior that is really used > only in for loops can be implemented with tuples as well. > > insted of: > for (int i = 0, long j = 0; ...; ...) {...}
Actually that's not legal syntax. You're thinking of "int i = 0, j = 0", which is parsed as a single declaration statement which declares two variables. This does not use the comma operator. The place where the comma operator is used is in the increment: for(..; ..; i++, j++) All that has to be done here is the comma has to be added to the increment grammar of the for loop. (MiniD does this.)
