github at esdiscuss.org (2013-07-12T02:27:21.721Z)
On 14 May 2013 17:07, Allen Wirfs-Brock <allen at wirfs-brock.com> wrote:
>
> What about providing a convenience `resume` method on generators to help clarify co-routine style usage? Dave suggested that "resume" was pedagogically useful.
>
> I would define it equivalently two:
>
> ```js
> resume(...args) {return this.next(...args)}
> ```
>
> (`resume` rather than `next` delegates to avoid the delegation for normal for-of iterations)
Not sure about having two names for the same method, but if so, why
not simply make `Generator.prototype.resume === Generator.prototype.next`?
On 14 May 2013 17:07, Allen Wirfs-Brock <allen at wirfs-brock.com> wrote: > > What about providing a convenience "resume" method on generators to help clarify co-routine style usage? Dave suggested that "resume" was pedagogically useful. > > I would define it equivalently two: > > resume(...args) {return this.next(...args}; > > (resume rather than next delegates to avoid the delegation for normal for-of iterations) Not sure about having two names for the same method, but if so, why not simply make Generator.prototype.resume === Generator.prototype.next? /Andreas