why foreach() don't use 'auto'?

ketmar ketmar at ketmar.no-ip.org
Thu Mar 27 02:19:19 PDT 2014


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().


More information about the Digitalmars-d mailing list