One-shot Delimited Continuations with Effect Handlers

Sebastian Markbåge sebastian at
Wed Mar 16 19:45:24 UTC 2016

> Although it is more work for the person writing code, I believe having
> to explicitly use keywords (await or yield) in function bodies makes
> it very clear what is happening, and ultimately leads to better code
> with less potential for human error in the long run.
> ...
> The beauty of JavaScript from the very beginning (the reason I love
> JavaScript) is that dealing with asynchronous behavior is something a
> JavaScript developer is forced to do from the get go.

I start from the premise that this explicitness is already a huge and
unmanageable problem through observation. Note my observation that nesting
various types of effects (async isn't the only one) makes this totally
unmanageable. If it wasn't, the status quo would be fine, but it isn't.

> Introducing invisible asynchronous behavior would deviate from that (and
> be more like Java).

The beauty of algebraic effects is that these side-effects can't just
randomly leak. If you're concerned about any particular code path having
these side-effects you can catch all the effects in that code-path. This is
very much unlike Java. That way you opt-in to that guarantee when you need
it, instead of forcing every little thing along the way make that decision.

> > we're not able to control scheduling or context in async functions?
> I think we can:
Your example demonstrates that explicitness can solve it but that is
exactly the problem that this proposal is trying to address. If you don't
agree with the premise that this is unmanageable there isn't much more to
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list