resume-to transfers control to the nearest enclosing
resumable handler that matches the resumption
value.
Syntax
(resume-to ⟨resumption-expr⟩)
Semantics
- The argument’s type must be an instance of the
Resumptionclass, which holds exactly for types defined withdefine-resumption.resume-tohas the typeResumption :r => :r -> :a, so functions that resume with a value of unknown type are polymorphic over resumption types. - Control leaves the current computation and enters the matching
resumablebranch. resume-tois typically called from ahandlebranch, which runs before unwinding, to recover from an exception thrown inside aresumableexpression. Acatchbranch runs after unwinding, so it can only resume to resumptions established outside thecatch.
Example
(define (serve-raw egg)
(resume-to (ServeRaw egg)))