Continuation - Kinds

Kinds

Support for continuations varies widely. A programming language supports re-invocable continuations if a continuation may be invoked repeatedly (even after it has already returned). Re-invocable continuations were introduced by Peter J. Landin using his J (for Jump) operator that could transfer the flow of control back into the middle of a procedure invocation. Re-invocable continuations have also been called "re-entrant" in the Racket language. However this use of the term "re-entrant" can be easily confused with its use in discussions of multithreading.

A more limited kind is the escape continuation that may be used to escape the current context to a surrounding one. Many languages which do not explicitly support continuations support exception handling, which is equivalent to escape continuations and can be used for the same purposes. C's setjmp/longjmp are also equivalent: they can only be used to unwind the stack. Escape continuations can also be used to implement tail call elimination.

One generalization of continuations are delimited continuations. Continuation operators like call/cc capture the entire remaining computation at a given point in the program and provide no way of delimiting this capture. Delimited continuation operators address this by providing two separate control mechanisms: a prompt that delimits a continuation operation and a reification operator such as shift or control. Continuations captured using delimited operators thus only represent a slice of the program context.

Read more about this topic:  Continuation

Famous quotes containing the word kinds:

    Don’t matter how much money you got, there’s only two kinds of people: there’s saved people and there’s lost people.
    Bob Dylan [Robert Allen Zimmerman] (b. 1941)

    There are only three kinds of people: those who serve God, having found him; others who are occupied in seeking him, not having found him; while the remainder live without seeking him and without having found him. The first are reasonable and happy; the last are foolish and unhappy; those between are unhappy and unreasonable.
    Blaise Pascal (1623–1662)