On Friday, 13 June 2014 at 09:29:25 UTC, Jonathan M Davis via
Digitalmars-d wrote:
I'd honestly rather see for(;;) {} removed than have foreach(;
0..n) {} added.
I don't like special cases like like these.
And I really don't think that it's a big deal to have to
provide a counter
variable that you're not going to explicitly use. I can see why
you'd want to
be able to skip providing the variable, but all it's saving you
is typing one
character, which doesn't at all seem worth it to me.
And if the argument is that the compiler could potentially make
optimizations
based on the lack of a variable, I would argue that the
compiler should be
able to make those same optimizations based on the fact that
the variable is
unused beyond being iterated over.
So, while I can see why you might like this, it seems like an
awfully small
thing for you to try and claim it's a big improvement.
- Jonathan M Davis
It's not about saving typing or optimisations. When someone omits
a parameter name when implementing an interface, or even after it
is no longer needed in a regular function, I know I don't have to
look for uses of that variable inside the function. The same
could be true for non trivial loops.
I don't have very strong feelings on the subject either way, but
IMO this is a valid point.