Next: , Previous: , Up: Top   [Contents][Index]


6 The unwind–protection mechanism

Unwind–protection allows operations to be performed synchronously with respect to the dynamic extent of a call to thunk; the mechanism is sophisticated because there are multiple, sophisticated ways to exit the dynamic extent of a function call. The typical application is to release asynchronous resources, like input/output ports and database connections.

To understand the unwind–protection mechanism we must understand the concepts “dynamic extent of a function call” and “dynamic environment” as defined by the Scheme standard.

The unwind–protection mechanism described here is used by MMCK Exceptional Conditions in: the implementation of compensations (see compensations); the implementation of the syntax try (see syntaxes try).

NOTE The unwind protection mechanism may misbehave in some cases, so do not trust it blindly (see unwind problems).


Next: , Previous: , Up: Top   [Contents][Index]

This document describes version 0.1.0-devel.1 of MMCK Exceptional Conditions.