3 ms·
One way to do delimited continuations might be to build on the state machine transformation behind generators and async/await. You can drop the `await`/`yield`
by Rusky 9y ago
One way to do delimited continuations might be to build on the state machine transformation behind generators and async/await. You can drop the `await`/`yield` primitives that C#/Javascript use and introduce a `shift` primitive instead. In non-recursive situations you can even make the continuation objects statically sized.
Kotlin goes this direction, for example, though it still requires an annotation on all functions that participate in continuations. This makes it fairly straightforward to tell where the `prompt` is- the root `suspend fun` passed to whatever API drives it. Making every function implicitly `suspend` would let you treat any function as a `prompt`.
- mamcx 9y agoAny example in how this is done? The info I have gathered is none what you have described!
- Rusky 9y agoThe best examples would just be the implementations of yield/async/await in C#, Javascript, Kotlin, Rust, etc. The only novel thing I'm proposing here is a shift in the syntax from explicit suspension points and implicit initiation of async operations, to implict suspension points and explicit initiation of async operations. Kotlin (which I mentioned) already mostly does this.