Things that may be removed

Frits van Bommel fvbommel at
Thu Dec 25 06:09:59 PST 2008

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

Actually, that isn't even needed. Since the return value of the 
increment is never used, and it can be any type at all, there would be 
no reason to change that line of code at all.
So the increment clause is suddenly a tuple? Who cares; it still 
increments just fine, doesn't it? :)

The only potential problem (which I just now thought of) would be 
increments with type void (e.g. ++i, iter.step()). Do tuple values allow 
void elements? If not, would it do any harm to allow them?

More information about the Digitalmars-d mailing list