Continuations Brief Summary. Studied the topic a bit and brought you a write-up. Should be interesting for people related to programming, and especially for scheme and lisp users.
https://trop.in/blog/continuations-brief-summary
#programming #scheme #lisp #clojure #commonlisp #callcc #continuation
#programming #scheme #lisp #clojure #commonlisp #callcc #continuation
I've been learning about Delimited Continuations lately, because I have recently learned that several programming language theory heavyweights, including Oleg Kiselyov, now believe the classic continuation control construct, e.g. "call/cc" in the #Scheme language, were big mistake that make program optimization needlessly difficult, though I don't fully understand why this would be the case. Unfortunately, "call/cc" is encoded in the Scheme language standard, so compiler authors need to come up with work-arrounds -- who knew at the time of the first revision (1975) it would be a bad idea?
Delimited Continuations solve the problems inherent in continuations (again, I don't understand why), and are *composable,* meaning it is easy to write modular pieces of code using continuations in isolation that can all be made to fit nicely together with a few simple high-order functions.
So fortunately for me, there is already a good #Haskell implementation, so I can probably figure it all out by just reading the code and studying the type definitions: https://hackage.haskell.org/package/CC-delcont
Here is the research paper by R. Kent Dybvig, Simon Peyton Jones, and Amr Sabry describing the implementation: https://legacy.cs.indiana.edu/~sabry/papers/monadicDC.pdf
Here is a primer on Delimited Continuations which I found helpful: https://gist.githubusercontent.com/sebfisch/2235780/raw/c1d9340e26fcf8b334d994c173d9c26fa8f4129f/gistfile1.md