On 14 March 2013 22:54, Brendan Eich <[email protected]> wrote: > Consider: > > var i = getSomeIterator(); > var x0 = i.next(), x1 = i.next(), x2 = i.next(); > for (let x of i) { > ... > } > > Should the loop iterate over x0, x1, and x2? That's what would (have to) > happen if i[@iterator]() returned a cloneof the iterator ireset to the > starting "position".
I agree this is an unsatisfactory consequence to the generatorObject.iterator = cloning proposal, which was meant as a kind of have-your-cake-and-eat-it-too compromise. It doesn't really achieve that, so I withdraw it. That leaves my original proposal not to have generator application return an iterator, but only an iterable. Under that proposal, your example requires disambiguation by inserting the intended call(s) to .iterator in the right place(s). /Andreas _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

