Sorry for the confusion -- my "such a change" was about changing @@iterator itself, e.g. not defining it on a generator, or trying somehow to guarantee freshness.

I agree, return automation makes sense for any delimited form that implicitly calls @@iterator.

There still may be an open issue, though: Python has ref-counting and pre-mortem finalization via close, last I checked. JS won't have any such thing. So are there ,in ES6, undelimited forms that implicitly call @@iterator and that won't implicitly maybe-call return?

/be

Jason Orendorff wrote:
On Thu, Apr 24, 2014 at 2:16 PM, Brendan Eich<bren...@mozilla.org>  wrote:
>  The only proposal (let's table whether the name is 'return' or @@return) is
>  whether for-of constructs should have a finally maybe-call of the iterator's
>  return method, if present. Like SpiderMonkey's JS1.7-1.8 close method, based
>  in part on Python 2.5 and up.

But in Python, closing iterators is part of the protocol. It isn't
mentioned in the language specification (Python does not have a
detailed spec) but all language and library facilities that consume
iterables do it, not just for loops.
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to