Mark S. Miller (2014-09-10T14:52:39.000Z)
On Wed, Sep 10, 2014 at 7:45 AM, Erik Arvidsson <erik.arvidsson at gmail.com>
wrote:

> For or loops are spec'ed to call the internal spec function, IteratorClose
> when there is an abrupt completion in the loop body (an exception was
> thrown, return and break)
>
> The point of this was to allow cleaning up the iterator in case it holds
> on to some kind of resource.
>
> The problem is that none of the other iterations in the spec calls
> IteratorClose. For example,
>
> ```js
> class MySet extends Set {
>   add(v) {
>     if (valueNoGood(v)) throw new NoGoodError();
>     return super(v);
>   }
> }
> new MySet(new ReadLines('~/test.txt'));
> ```
>
> In the above code `ReadLines.prototype.return` is never called, defeating
> the whole purpose of adding return hooks to for-of.
>
> I see two options here.
>
> 1. Add IteratorClose to all places in the spec where we use iterators.
>

Why was #1 rejected? I just don't remember.



> 2. Remove IteratorClose from for-of loops.
>
> I know we talked about this before on several occasions but I'm still
> unhappy with the current state.
>
> --
> erik
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>


-- 
    Cheers,
    --MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140910/28969c46/attachment.html>
domenic at domenicdenicola.com (2014-09-17T21:59:48.449Z)
Why was #1 rejected? I just don't remember.