This is exactly what's proposed for ES6, except s/.source/.value/. See
also PEP-380.
/be
Claude Pache wrote:
In order to mitigate the problem, instead of throwing a generic StopIteration, I think we
ought to throw a specific StopIteration instance with information on which iterator has
thrown. More precisely, inside a generator function, a return statement will throw a
StopIteration instance with its "source" property set to the generator iterator
which was terminated.
For manually throwing a StopIteration from inside a "next" method of an
iterator, we could use:
throw new StopIteration(this)
And instead of "e instanceof StopIteration", we may use a more precise check:
e instanceof StopIteration&& e.source === it
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss