### Controlling
[
Datatype continuations
Funcon continuation
Entity plug-signal
Funcon hole
Funcon resume-continuation
Entity control-signal
Funcon control
Funcon delimit-current-continuation Alias delimit-cc
]
Meta-variables
T, T1, T2 <: values
Datatype
continuations(T1,T2) ::= continuation(_:abstractions(null-type=>T2))
*/
Entity
_ --plug-signal(V?:values?)-> _
*/
Funcon
hole : =>values
*/
Rule
hole --plug-signal(V)-> V
Funcon
resume-continuation(K:continuations(T1, T2), V:T1) : =>T2
*/
Rule
X --plug-signal(V)-> X′
---------------------------------------------------------------------------
resume-continuation(continuation(abstraction(X)), V:T) --plug-signal()-> X′
Entity
_ --control-signal(F?:(functions(continuations(T1, T2), T2))?)-> _
*/
Funcon
control(F:functions(continuations(T1, T2), T2)) : =>T1
*/
Rule
control(F:functions(_,_)) --control-signal(F)-> hole
Funcon
delimit-current-continuation(X:=>T) : =>T
Alias
delimit-cc = delimit-current-continuation
*/
Rule
delimit-current-continuation(V:T) ~> V
Rule
X --control-signal( )-> X′
-----------------------------------------------------
delimit-current-continuation(X) --control-signal( )->
delimit-current-continuation(X′)
Rule
X --control-signal(F)-> X′
------------------------------------------------------------------
delimit-current-continuation(X) --control-signal( )->
delimit-current-continuation(apply(F, continuation closure(X′)))
/*
`continuations(T1, T2)` consists of abstractions whose bodies contain a `hole`, and which will normally compute a value of type `T2` when the `hole` is plugged with a value of type `T1`.