4 ms·
What is the difference between call/cc and delimited continuations?
by svieira 6y ago
What is the difference between call/cc and delimited continuations?
- mst 6y agoMy main interest: delimited continuations are only valid within a specific stack extent so they're much for viable for extensive use - one could argue that async/await is kinda the simplest (and most limited) possible delimited continuation implementation. For a better understanding, https://en.wikipedia.org/wiki/Delimited_continuation https://en.wikipedia.org/wiki/Delimited_continuation didn't feel like a terrible start and I'm far from an expert here.
- dreamcompiler 6y agoThe fully-general continuations that call/cc creates require copying chunks of the stack to the heap for storage and back again when they're used. (Or pointing the stack pointer at the heap, which I find even more cringe-inducing.) They're memory hogs whose lifetimes are hard to reason about and they provide relatively little benefit to most programs, which is why Common Lisp doesn't provide them.
- michaelsbradley 6y agoDelimited continuations, a.k.a composable continuations, are. a generalization of control operators such as call/cc. https://en.wikipedia.org/wiki/Delimited_continuation https://en.wikipedia.org/wiki/Delimited_continuation
- bjoli 6y agoThey are faster, easier to reason about, less prone to leak memory and are always what you want. Everyone except maybe the chicken scheme people agree, but call/cc is free for them due to their GC strategy.
- dleslie 6y agoChicken and Cyclone share the same gc strategy.
- bjoli 6y agoOooh: in addition to my other comment. Don't trust me, trust Matthew Flatt when he talks at Microsoft Research: https://youtu.be/IKddmXjYa5U https://youtu.be/IKddmXjYa5U It contains a very telling comparison about delimited vs undelimited continuations and sows quite clearly by you always want delimited ones.