Rewinding iterators

David Bruant bruant.d at gmail.com
Mon Apr 7 01:00:32 PDT 2014


Le 07/04/2014 02:31, Marcus Stade a écrit :
> In section 25.1.2 of the spec 
> <http://wiki.ecmascript.org/lib/exe/fetch.php?id=harmony%3Aspecification_drafts&cache=cache&media=harmony:working_draft_ecma-262_edition_6_04-05-14.pdf> 
> it says:
>
>     The function returns an object that conforms to the IteratorResult
>     interface. If a previous call to the next method of an Iterator
>     has returned an IteratorResult object whose done property is true,
>     then all subsequent calls to the next method of that object must
>     also return an IteratorResult object whose done property is true,
>
>
> Are there any practical reasons why the Iterator interface explicitly 
> disallows this?
There is no good reason indeed. Worse, there is no way to enforce it on 
user-generated iterators, so it'd be dangerous for standard iterator 
consumers to assume such a property.

This mention should probably be removed altogether.
Filed https://bugs.ecmascript.org/show_bug.cgi?id=2606

Thanks,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140407/2a25fe06/attachment-0001.html>


More information about the es-discuss mailing list