On Thursday, 27 March 2014 at 09:19:20 UTC, ketmar wrote:
why foreach() using the current syntax instead of clearer one:
foreach (auto v; smth)?
i think that adding 'auto' will make foreach() less confusing,
as
it clearly points that 'v' is a local variable for foreach()
scope. and i think that it will be in line with other forms such
as foreach(immutable v; smth), etc.
current foreach() syntax (without auto) still sometimes
confusing
me and forcing to believe that i should either put 'auto' inside
foreach() or somehow declare 'v' before foreach().
You can use `auto` in foreach, as well as any explicit type. It
can be omitted because it is unambiguous.