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

ketmar ketmar at ketmar.no-ip.org
Fri Mar 28 01:22:23 PDT 2014


> error: basic type expected, not auto
ah grok it. that's cause foreach() is just a syntactic sugar for 
call with delegate arg, and we can't use 'auto' in arglist.

it's perfectly logical from the point of compiler writer, but 
still forces language user to remember that foreach() is a very 
special beast. i think that just ignoring 'auto' in foreach() 
parser will not harm anyone and will bring 'normal user logic' 
back.

but i'm relatively new to D, so i need some discussion before 
entering request to bugzilla: maybe this is a very old problem 
that was talked to death?


More information about the Digitalmars-d mailing list