On Jun 16, 2014, at 11:29 AM, Michael Zhou wrote: > Thanks for the clarification, one detail about the order between incrementing > and setting $$lastIteration_i: > { > let i = $$lastIteration_i; //create and initialize per iteration i > if (!(i<10)) break; > { > let i; > } > i++; > $$lastIteration_i = i; > } > > Should it be > $$lastIteration_i = i; > i++; > > instead, given what the spec says? neither of these desugarings is perfectly in alignment with the actual spec. which doesn't actually use a temp variable in this manner.
A closer match would be: $$lastIteration_i = i; $$lastIteration_i++; The value of the new i for the next iteration is the incremented value of the previous i, but the value of the previous i is not incremented which is important for the cases where a closure has captured the previous i. Allen
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss