Concatenative topics
Concatenative meta
Other languages
Meta
Continuations are a feature originally found in Scheme. They have a reputation for being hard to understand and somewhat mysterious. In Concatenative languages, continuations have a very simple explanation: they are a snapshot of the stacks. In Factor, a continuation is an instance of a tuple with several slots, one for each stack:
TUPLE: continuation data call retain name catch ;
Reifying a continuation creates a copy of the stacks, and reflecting it restores the saved copies. That's the only primitive needed to implement exception handling, coroutines, co-operative threads, and backtracking in Factor.
This revision created on Mon, 24 Jul 2023 11:48:33 by cerum