The work surrounding an expression

When an inner expression finishes, its surrounding computation may still need to add a value, call a function, or produce output. A continuation represents that remaining work. For example, a position whose result must be increased by two and then tripled has those pending operations in its evaluation context.

References: [1]

Capturing a context as a value

Scheme’s call-with-current-continuation passes a representation of the current continuation to a procedure. The program can retain it and later supply a value to the saved context. This does not mean rereading a source file or taking a snapshot of the external world: completed file or database changes are not automatically undone.

References: [2]

Supporting nonlocal control

A nested computation can use a captured continuation to leave several surrounding calls with a chosen result. R5RS illustrates such nonlocal exits and permits retained continuations to outlive the original call. Different control operators nevertheless have different restoration and composition behavior; they should not be treated as ordinary function returns.

References: [1] [2]

Delimiting the captured context

Racket uses prompts to delimit capture and distinguishes composable continuations from operations that abort the current context before restoring another. A delimiter limits the captured work rather than handing over an unspecified entire future. Correct reasoning requires knowing both the capture boundary and the behavior used when invoking the saved continuation.

References: [1]