Dean Landolt schrieb:
On Wed, Feb 25, 2015 at 2:39 PM, Bergi <a.d.be...@web.de> wrote:

If you are using generators for async, then you'd call `return()` when
your result promise is cancelled.

That seems a bit surprising to me -- I'd expect a cancelled promise to
result in some kind of exception being thrown into my coroutine-style
generator, not for execution to silently return out of the generator
entirely.

Why? That's just what cancellation means. You can't do anything any more anyways, as there is nothing to return a result to (assuming a pure algorithm of course, but would you really like to execute side effects on cancellation?). It is the same as if the coro runner simply dropped your generator and the yield never returned - except `finally`-blocks would still be executed.

IIUC calling `return` on a coroutine would be analogous to a
TCP-preserving control flow construct

What's TCP-preservation? (Not exactly a googleable term)

 Bergi

_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to