Allen Wirfs-Brock (2014-09-10T16:32:08.000Z)
On Sep 10, 2014, at 9:00 AM, Andreas Rossberg wrote:

> On 10 September 2014 17:56, Allen Wirfs-Brock <allen at wirfs-brock.com> wrote:
>> We agree at our June meeting to add the "return" method to generators and to
>> conditionally call "return" (if it is present) when a for-of loop terminates
>> before it exhausts its generator. See
>> https://github.com/rwaldron/tc39-notes/blob/master/es6/2014-06/jun-5.md#conclusionresolution-2
>> .  IteratorClose is part of the implementation of this features and was
>> added in Rev 27 of the spec.
>> 
>> I believe that #1 is implicit in that decision as it has always been an ES6
>> goal that most library methods should be self-hostable in ES. That means
>> that for-of like iteration in those methods should be specified in a manner
>> that matches the observable semantics of for-of.
> 
> It wasn't all that clear to me, but that's good to hear. Does a
> similar argument apply to constructs like rest and spread?

Yes, except that I don't think the "body" of those loops can actually abnormally exit (or in the case of processing parameter lists, the iterator is an internal list iterator that doesn't have a 'return').  But that code should be reviewed to make sure I don't miss something.

Allen
domenic at domenicdenicola.com (2014-09-17T22:01:00.553Z)
Yes, except that I don't think the "body" of those loops can actually abnormally exit (or in the case of processing parameter lists, the iterator is an internal list iterator that doesn't have a 'return').  But that code should be reviewed to make sure I don't miss something.