On Wed, 11 Jan 2012 16:49:35 -0600, Nick Sabalausky <[email protected]> wrote:

"Ben Davis" <[email protected]> wrote in message
news:[email protected]...

Note that this is already supported (apologies if I've got the syntax
slightly wrong):

foreach (i, ref tile; map) { ... }

That's a local variable too. It could have instead been defined such that
"tile" is an alias for "map[i]", but that would be a little strange.


That's a very good point.

Technically, foreach is implemented such that its body is a function and the
"i, ref tile" is the parameter list. But I think that's beside the point.

Given that enabling foreach's syntax for general D functions, i.e.

myLoop(i, ref tile; map) { ... }

has been discussed several times in this newsgroup, the fact that "i, ref tile" 
is the parameter list of a delegate is not beside the point.

Reply via email to