> > 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 it.
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss