Maybe we don't need foreach ;-)
Bill Baxter
dnewsgroup at billbaxter.com
Mon Oct 30 18:28:05 PST 2006
Just like some people have said, you can do everything with 'for'.
Well, actually maybe you can. It occurred to me that foreach and for
really don't clash. One requires two semicolons, the other only one.
So instead of a foreach we could have had
for(a; aggregate)
{
}
or if the keyword 'in' had been used for the new construct instead of
borrowing from c's ; syntax it would be:
for(a in aggregate)
{
...
}
which could quite peacefully coexist with good-ole
for (int i=0; i<10; i++)
{
}
Oh well. Too much momentum behind foreach and foreach_reverse now, I
suppose, to make such a simplification.
--bb
More information about the Digitalmars-d
mailing list