IteratorClose on spread expression

Claude Pache claude.pache at gmail.com
Tue Jun 23 14:37:32 UTC 2015


> Le 23 juin 2015 à 14:58, Gary Guo <nbdd0121 at hotmail.com> a écrit :
> 
> To me it seems that spread expression will not call IteratorClose (neither in ArrayLiteral nor in Argument List), but IteratorClose is called in other places in the spec where iterators are used, ex. for-of, destructuring, builtin functions). Is this intended or this is a bug in the spec?
> 
> Gary Guo

In spread expressions for instance, the iterator is supposed to close itself, either when it is exhausted or when it throws an exception.

But in some places, like for/of loops or destructuring assignments, an abrupt completion may come from an other source than the iterator being traversed; in which case (and only in that case) the iterator is explicitly closed.

—Claude
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150623/f1e829c5/attachment.html>


More information about the es-discuss mailing list