Next: , Previous: , Up: dynamic environment   [Index]


D.3 The dynamic extent of a function call

The dynamic environment is maintained by the standard function dynamic-wind, which has the arguments:

(dynamic-wind in-guard thunk out-guard)

the thunk in-guard is called every time the execution flow enters the dynamic extent of the call to thunk; the thunk out-guard is called every time the execution flow exits the dynamic extent of the call to thunk.

When we call dynamic-wind: the in-guard and out-guard thunks are pushed on a stack referenced by an internal Vicare global variable. Whenever we save the current continuation by calling call/cc: such internal stack is stored in the state of the created continuation.

We always create the dynamic extent of a function call by calling the function; then, by saving continuations, we can enter and exit the dynamic extent any number of times. Let’s try to understand what this means.

About exiting from the dynamic extent of a function call, we must acknowledge that:


Next: , Previous: , Up: dynamic environment   [Index]