is an iterator allowed to reuse the same state object?

2015-04-27 Thread John Lenz
By which I mean the object that returns the current value and done state? ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: is an iterator allowed to reuse the same state object?

2015-04-27 Thread Bergi
No, it must return a new object every time. See https://esdiscuss.org/topic/performance-of-iterator-next-as-specified for the last discussion on this. Bergi ___ es-discuss mailing list es-discuss@mozilla.org

Re: is an iterator allowed to reuse the same state object?

2015-04-27 Thread Allen Wirfs-Brock
On Apr 27, 2015, at 3:29 PM, Tab Atkins Jr. wrote: On Mon, Apr 27, 2015 at 3:11 PM, John Lenz concavel...@gmail.com wrote: By which I mean the object that returns the current value and done state? IIRC, it's not supposed to. The built-in iterators will return fresh objects each time, so

Re: Subclassing ES6 objects with ES5 syntax.

2015-04-27 Thread Kevin Smith
x = Reflect.construct(Promise, x, C); is another fine way to fool someone who wrote C.resolve(x) and expected to get an instance of C back. Thanks for pointing this out. I believe the ability to use an arbitrary newTarget parameter for Reflect.construct is breaking the intent of

Re: is an iterator allowed to reuse the same state object?

2015-04-27 Thread Tab Atkins Jr.
On Mon, Apr 27, 2015 at 3:11 PM, John Lenz concavel...@gmail.com wrote: By which I mean the object that returns the current value and done state? IIRC, it's not supposed to. The built-in iterators will return fresh objects each time, so there's no mutation hazard. Userland iterators can of