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(;;)for (var i=0, n<n; I++) capture(function () {i}); still have to be modified to for (let i=0, n<n; I++) capture(function () {i}); to "fix" the capture bug in existing code. Why not make the new better way something like for (let i of range(0,n)) capture(function () {i});
I'm a big fan of iterators and this will be winning. Indeed many languages add a range operator for more convenience:
for (let i of 0..n) ... or perhaps ... (yech).
and promote the hell out of it while leavingfor(;;) as is.
Here I demur. We can promote all we want. Won't necessarily do a thing to JS developers who see for(let;;) as a better way to write (or migrate, note well) code they wrote (or inherited, double note well) that uses for(var;;).
Maybe don't even add let/const forms to for(;;).
Again I dissent. We're not making a "new language", so breaking symmetry to deprecate looks like nanny-ing. It usually fails, in my experience. It doesn't help migration.
You make a good point: we should not overcomplicate for(let;;) at high cost. I'm happy with Andreas's proposed 0th-iter scope desugaring, modulo nagging doubts that are going away even as I type.
/be _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

