On Mon, 01 Nov 2010 10:09:17 -0400, Gary Whatmore wrote: >> I think this is better: >> >> for (ref x : array) >> x *= 2; >> >> Apart from being 4 chars shorter, I think it looks more natural using >> the ':' instead of ';'. A lesser benefit is it allows reuse of the >> 'for' keyword, making the 'foreach' keyword unnecessary. >> >> Maybe this would be acceptable for D? > > No, 1) it's too late to change it.
I don't see a technical reason why foreach, the above for syntax and 'C' for syntax can't all be supported. > 2) the syntax comes from Java. Perhaps if C++0x does add this and Java already has it this makes more of an argument for D supporting it?
