They’re called so because of the way they are implemented (in general).
Quoted from Direct Implementation of Shift and Reset in the MinCaml Compiler
By interpreting a program using the
continuation semantics, we can regard
the state of the program as a
continuation stack. Then,resetcan be
thought of as marking the continuation
stack, andshiftcapturing the
continuation stack up to the nearest
mark created byreset. Here is the
overview of the implementation:
- When calling
reset, set a reset mark to the stack- When calling
shift(fun k -> M), move a part of the stack frames up to
the nearest reset mark to the heap- When calling a continuation
k, set a reset mark to the stack and copy the
corresponding frames from the heap to
the stack top.A reset mark is inserted when
kis
called, because captured continuations
are executed in an empty continuation.