return when desugaring to closures

Waldemar Horwat waldemar at google.com
Mon Oct 13 17:25:17 PDT 2008


Jon Zeppieri wrote:
>> Why is the assignment operator relevant? The question is the binding
>> scope of i in
>>
>>   for (let i = 0; i < N; i++) ...
> 
> 
> How is scope the issue?  As far as I know, we don't disagree about scope.
> 
> The assignment I'm referring to, in this example, is the 'i++' part.
> Mark is proposing that this does not mean "increment i by one," but
> rather "rebind i with the value of i+1" -- which is completely
> different and not what the user wrote.

Really?  I'm having a hard time believing that.

I agree that a for-in loop should generate a new binding for each iteration, but there is no sensible way to do it for a regular for(;;) loop unless we introduce a new form of for-loop that has explicit rebinding expressions.

    Waldemar


More information about the Es-discuss mailing list