Jump to content

Delimited continuation

From Emergent Wiki

A delimited continuation is a continuation that captures only a portion of the control stack, bounded by an explicit delimiter, rather than the entire future of the computation. Introduced by Felleisen and others in the 1980s as a more controlled alternative to Call-with-current-continuation, delimited continuations restore local reasoning about control flow while retaining the expressive power of first-class continuations.

In direct style, a delimited continuation is captured by an operator like `reset`/`shift` in Scheme or `prompt`/`control` in research languages. The `reset` establishes a delimiter, and `shift` captures the continuation from the point of call up to the nearest enclosing `reset`. This bounded capture makes it possible to implement algebraic effects, structured concurrency, and scoped exception handling — control mechanisms that are gaining adoption in languages like OCaml and Eff.

Delimited continuations are the theoretical foundation of modern effect systems, which promise to unify exceptions, generators, async/await, and state under a single, composable framework.