Things that may be removed

Jarrett Billingsley jarrett.billingsley at gmail.com
Wed Dec 24 15:09:14 PST 2008


On Wed, Dec 24, 2008 at 5:24 PM, Yigal Chripun <yigal100 at gmail.com> 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.)



More information about the Digitalmars-d mailing list