A representation of the rest of a computation. In continuation-passing style, a computation receives a function telling it how to use its result. An explicit computer memory argument can be supplied when the continuation is invoked, so capturing control need not capture a snapshot of computer memory.
A computation that can suspend and later resume. A first-class continuation can represent its suspended control state while mutable computer memory remains shared.
Tasks transfer control at explicit suspension points. A FIFO queue of runnable continuations implements round-robin scheduling; a task that never transfers control can prevent others from running.
A continuation represented as an ordinary language value that can be stored and later invoked. Whether it may be invoked once or repeatedly, and whether mutable program state is restored, are separate semantic choices.
Supply the current continuation to a user function. A language can expose this as an escape function or as a separate continuation value with its own invocation primitive; those interfaces need corresponding semantic definitions.
Pass the remaining computation explicitly as a continuation. Returning a value means invoking that continuation; a different control destination can be selected by invoking a different continuation.
Articles by others on the same topic
There are currently no matching articles.