Hi Allen, On Mon, 2012-02-06 at 11:08 -0800, Allen Wirfs-Brock wrote: > We're putting a lot of energy into trying to figure out how to "fix" > for(let;;) when it probably shouldn't even be the preferred form of > numeric looping going forward. If we can make for-in/for-of attractive > enough then it is less clear why we need to fix for(;;) [...] > Maybe don't even add let/const forms to for(;;).
Just as food for thought, here's a C# designer on why they decided to leave "for (int i=0; i<N; i++)" alone, when they decided to make "for (int i in L)" bind a fresh "i": We have this same problem in "for" blocks, but "for" blocks are much looser about what "the loop variable" is; there can be more than one variable declared in the for loop header, it can be incremented in odd ways, and it seems implausible that people would consider each iteration of the "for" loop to contain a fresh crop of variables. When you say for(int i; i < 10; i += 1) it seems dead obvious that the "i += 1" means "increment the loop variable" and that there is one loop variable for the whole loop, not a new fresh variable "i" every time through! We certainly would not make this proposed change apply to "for" loops. http://blogs.msdn.com/b/ericlippert/archive/2009/11/12/closing-over-the-loop-variable-considered-harmful.aspx Regards, Andy _______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss