A good description of continuations (parts 1, 2a, 2b, 2c).
[from a post to python-dev; not posted to front page because it may be a duplicate - haven't been reading lately]
It strikes me (at last!) that "continuation" is used in two different ways. First (eg the "Continuations in Java" paper recently), as "the ('ordinary') function you call next. I'd call this "weak continuations". If program state over time is viewed as a tree then weak continuations don't allow you to jump to arbitrary nodes - you traverse the tree recursively (and so can use a stack to store program state). Then, second, there's "strong continuations", as described in these links, where that function includes the program state (including call path). Calling such a function replaces the call path and so allows access to arbitrary nodes in the tree of program states.
Is that correct? If so, which kind of continuation is meant when people refer to "compiling with continuations"? Do they mean writing a compiler that supports a language with strong continuations? Or do they mean that using weak continuations is a useful way of structuring compilers? What other uses of continuations are there, and which kind of continuation is considered?
|