loop unrolling and completion values in ES6

Allen Wirfs-Brock allen at wirfs-brock.com
Thu Apr 9 15:01:40 UTC 2015


> On Apr 9, 2015, at 10:44 AM, Alan Schmitt <alan.schmitt at polytechnique.org> wrote:
> 
> 1. Let sl be the result of evaluating StatementList.
> 2. ReturnIfAbrupt(sl).
> 3. Let s be the result of evaluating StatementListItem.
> 4. If s.[[type]] is throw, return Completion(s).
> 5. If s.[[value]] is empty, let V = sl.[[value]], otherwise let V = s.[[value]].
> 6. Return Completion{[[type]]: s.[[type]], [[value]]: V, [[target]]: s.[[target]]}.
> 
> The problem happens when the first statement of the body of the while
> loop is a break: in that case the value from the previous iteration is
> not carried over.

I agree, each kind of loop needs  to do its equivalent of step 5 above before checking for exit conditions, that is the opposite of what is currently specified.

Allen

> 



More information about the es-discuss mailing list