All three generator methods do the same basic thing:  they resume the
generator with a "completion" and return the next-yielded-value (or the
return value, if done is true).  The only difference is which type of
completion is used to resume the generator:  "normal", "throw", or "return".

On Wed, Feb 25, 2015 at 8:27 AM, Axel Rauschmayer <[email protected]> wrote:

> If I understand, correctly, `someGeneratorObject.return(v)` usually
> produces `{ value: v, done: true}`. The alternative would be that this
> method returns immediately (with `undefined`) and queues up that object to
> be returned by `next()`. That’s what would happen if the generator itself
> executed a `return` statement.
>
> I don’t know which alternative makes more sense, but I’d love to find out
> more about the rationale behind this particular design decision.
>
> Thanks!
>
> Axel
>
> --
> Dr. Axel Rauschmayer
> [email protected]
> rauschma.de
>
>
>
>
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to