ECMAScript 6 should be bringing generator functions and iterators. A generator function (which has the function* syntax) returns an iterator. The iterator has a next method which, when repeatedly called, executes the body of the generator function, repeatedly pausing and resuming execution at every yield operator.
The ECMAScript 6 wiki on generators also introduces the "delegated yield" yield* operator as follows:
The
yield*operator delegates to another generator. This provides a convenient mechanism for composing generators.
What does "delegate to another generator" mean? How can I use yield* to "conveniently compose generators"?
[You can play with generators in Node v0.11.3 with the --harmony-generators flag.]