Re: The result of Generator.prototype.return

2015-02-25 Thread Axel Rauschmayer
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. OK. I see

Re: The result of Generator.prototype.return

2015-02-25 Thread Kevin Smith
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,

Re: The result of Generator.prototype.return

2015-02-25 Thread Axel Rauschmayer
On 25 Feb 2015, at 15:33, Kevin Smith zenpars...@gmail.com wrote: OK. I see the use case for `throw()` (e.g. to convert a promise rejection into an exception when using generators for async). The only use case for `return()` is closing an iterator, then(?) Or for closing a data sink, if

Re: The result of Generator.prototype.return

2015-02-25 Thread Dean Landolt
On Wed, Feb 25, 2015 at 2:39 PM, Bergi a.d.be...@web.de wrote: Axel Rauschmayer schrieb: OK. I see the use case for `throw()` (e.g. to convert a promise rejection into an exception when using generators for async). The only use case for `return()` is closing an iterator, then(?) If you

Re: The result of Generator.prototype.return

2015-02-25 Thread Bergi
Axel Rauschmayer schrieb: OK. I see the use case for `throw()` (e.g. to convert a promise rejection into an exception when using generators for async). The only use case for `return()` is closing an iterator, then(?) If you are using generators for async, then you'd call `return()` when