10.3 Continuations
A continuation represents a captured evaluation context. Control can “jump” into a continuation by delivering values to it, or by using it with Continuation.in.
annotation | |
expression | ||||||||||||||||||
| ||||||||||||||||||
| ||||||||||||||||||
| ||||||||||||||||||
| ||||||||||||||||||
| ||||||||||||||||||
| ||||||||||||||||||
|
The ~catch clauses is superficially similar to ~catch in try, but ~catch in Continuation.prompt does not catch exceptions. Instead, it determines a handler that is used to receive any values delivered to the prompt via Continuation.escape. The handler is call with the continuation of the Continuation.prompt form. Since multiple values can be delivered by an escape, the ~catch construction can accept multiple values or dispatch on the number of values received. The default prompt handler expects a single thunk, and calls the thunk under a prompt with the same tag as the handler’s prompt.
expression | ||||||||
| ||||||||
| ||||||||
|
The captured continuation is delimited by a prompt with the tag specified by tag_expr, where Continuation.PromptTag.default is used if tag_expr is not present. A prompt with the designated tag must be present in the current continuation at the time of capture.
The captured continuation is composable, which means that the capture continuation extends the current one when it is called, and no prompt is required in the continuation of the call to the capture continuation.
expression | |||
|
function | |||||
|
annotation | |
function | |||
| |||
value | |||
If name is provided to Continuation.PromptTag.make, it is used only for printing and other debugging purposes.
expression | |||
|
k
Continuation.capture: cannot capture past continuation barrier
k
#<function>
annotation | |
function | |
expression | |||
|
function | |||||
|