function cpsfoo(cb) {...}
function foo() {
var thread = this_thread()
cpsfoo(x => thread.resume(x))
return thread.yield()
}
Error and immediate cb invokation handling omitted for clarity. Similar wrapper or wrapper-generator (uncps(f), unpromise(f)) may be done for other primitives.... but this is exactly the reason why callback hell existed. Error handling down the callback branches were a total mess, especially with networked state transfers.
This is an example for something that might come up in Javascript, using async/await:
const a = await fetchA();
const b = await fetchB(a);
const stuff = await fetchStuff(a, b);
const transformedStuff = await Promise.all(stuff.map(someAsyncTransform));
Error handling is just try/catch.Note that you generally have no control over most of these function being asynchronous. Threads or coroutines do nothing to help you write straightforward code when all your libraries are based on fine-grained callbacks/promises. Writing out that chain of dependencies in CPS would be a nightmare.
Those benefits being that the async/await syntax and semantics for working with Promises more closely resembles the imperative code it replaces, whereas the join calculus is its own [sometimes easy, admittedly] learning curve with its own syntax and semantics. Most of the complaints about Promises are the usual complaints about monadic wrapping types that the types become "viral" and "color" all associated code. But that just means that the failure cases are more easily picked up by a static type checker than semantic failures in learning the join calculus.
Node is built on V8, which is built for browsers. Browsers have a single threaded execution model that also hides an event loop that runs the entire tab.
>async computation mature over the years
A good thing, really, but would be much better if the experience from few decades ago wasn't ignored by cool kids who mature.