for-of loops, IteratorClose and the rest of the iterations in the spec

Andreas Rossberg rossberg at google.com
Wed Sep 10 09:00:36 PDT 2014


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?

/Andreas


On 10 September 2014 17:56, Allen Wirfs-Brock <allen at wirfs-brock.com> wrote:
>
> On Sep 10, 2014, at 8:29 AM, Mark S. Miller wrote:
>
> Hi Allen, does that mean we agreed to the equivalent of Arv's #1? If so,
> great!
>
>
> 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.
>
> Allen
>
>


More information about the es-discuss mailing list