2 ms·
Poor man's delimited continuations.
by kazinator 3y ago
Poor man's delimited continuations.
- bear8642 3y agoCould you expand? I have a limited understanding of continuations and never used them myself.
- tonyg 3y agoYep. Delimited continuations and proper tail calls gives a superpower. (Even PTC alone...)
- gpderetta 3y agoBut stackful coroutines and (one shot) delimited continuations are equivalent in power and expressivity. Unless you are referring to stackless coroutines or multi-shot continuations.
- kazinator 3y agoNever heard of one shot delimited continuations; it sounds like an euphemism for "broken". Delimited continuations are functions; you can call them as many times as you like, with different arguments. They can call themselves recursively too. Of course when I say "delimited continuation", I mean "delimited continuation" not "broken delimited continuation". (If delimited continuations are used for simulating coroutines, it is my experience that they end up being called only once; each continuation invocation performs a time slice to the next yield. That's a particular simple use of continuations, not a type.)