On Wednesday, 30 October 2013 at 12:28:13 UTC, Max Samukha wrote:
On Wednesday, 30 October 2013 at 12:17:29 UTC, Max Samukha
wrote:
So D managed to mess up closures, too. And that's after years
of countless complaints about the same issue in JS!
And please no misguided arguments like
http://blogs.msdn.com/b/ericlippert/archive/2009/11/12/closing-over-the-loop-variable-considered-harmful.aspx.
Quoting : "UPDATE: We are taking the breaking change. In C# 5,
the loop variable of a foreach will be logically inside the loop,
and therefore closures will close over a fresh copy of the
variable each time. The "for" loop will not be changed. We return
you now to our original article."
Javascript is introducing the let keyword to create properly
scoped variables. It seems everybody agrees on what should have
been done.