lexical for-in/for-of loose end
jason.orendorff at gmail.com
Sat Feb 4 06:02:46 PST 2012
On Fri, Feb 3, 2012 at 7:26 PM, Allen Wirfs-Brock <allen at wirfs-brock.com> wrote:
> On Feb 3, 2012, at 4:26 PM, Jason Orendorff wrote:
>> On 2/3/12 6:13 PM, Allen Wirfs-Brock wrote:
>>> But I also have to validly (and hopefully reasonably) specify exactly what happens for the unrealistic use cases. There is a problem with your desugaring in that the evaluation of INIT isn't scoped correctly relative to V.
>> Hmmm. I don't see the problem yet. I think it's scoped the way I intended it: INIT is evaluated in the enclosing environment; V isn't in scope.
> Under the scoping rules TC39 has agreed to, the initializer of a let/const is always shadowed by the binding it is initializing[...]
That rule doesn't make sense in this context. There should be either
one V for the whole loop, or one V per iteration. Having both seems
Again, one can focus on parallels between "for(let V=E;;)" and "let
V=E;" or on parallels between "for(let V=E;;)" and "for (let V of E)".
I find the latter more important because experience and evidence
suggest that that is what will affect users in practice.
More information about the es-discuss