Continuations
Factor handbook ยป The language

Prev:Macros
Next:Vocabulary loader


At any point in the execution of a program, the current continuation represents the future of the computation.

Words for working with continuations are found in the continuations vocabulary; implementation details are in continuations.private.

Continuations can be reified with the following two words:
callcc0 ( quot -- )

callcc1 ( quot -- obj )


Another two words resume continuations:
continue ( continuation -- * )

continue-with ( obj continuation -- * )


Continuations as control-flow:
attempt-all ( ... seq quot: ( ... elt -- ... obj ) -- ... obj )

with-return ( quot -- )


Continuations serve as the building block for a number of higher-level abstractions, such as Exception handling and Co-operative threads.
Continuation implementation details