David-Sarah Hopwood wrote:
> Neil Mix wrote:
>> The for/closures "bug" is definitely a newbie trap, but its pain is  
>> not its discovery, but the difficulty of working around it.  To me  
>> this could be a winning argument against re-binding on each loop,  
>> since re-binding precludes the (admittedly dubious) use-case of  
>> updating inside the body:
>>
>> for (let i = 0; i < 100; i++) {
>>    if (skipAhead) {
>>      i += 9;
>>      continue;
>>    }
>>    ...
>> }
> 
> The expansions that MarkM and I posted work correctly in that case.
> 
> ("Correctly" means what a C programmer would expect :-) To be more
> specific, updates within the body take effect for the instance of
> the variable that is seen by the update expression for the next
> iteration.)

What I meant to say was: Updates within the body affect the value of
the variable instance that is seen by the update expression for the
next iteration.

-- 
David-Sarah Hopwood
_______________________________________________
Es-discuss mailing list
Es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to