next up previous contents index
Next: Basic abstractions derived from Up: Features of A++ Previous: Lexical Scope   Contents   Start


Closure

The `Closure' principle is so important in A++, because all lambda abstractions are closures, that we would like to list it together with the constitutive principles above. But because all features of a closure can be derived from the principles above, we have to list it separately.

The term closure is an encapsulation of a lambda-abstraction with its total environment at the time of creation of the lambda-abstraction. This environment consists of all the names that this lambda abstraction has access to.

img16.gif\includegraphics[scale=0.80]{img/closure.eps}

The diagram above uses a technique introduced in [AwJS96] representing a closure by two circles. The first one (in our case the black bullet) sympolizes the function and the second one the environment. In our diagram the expressions in the function body have access to all variable bound to the `lambda', i.e. the arguments and to all variables contained in `environment 1'.

For more details readers are referred to the discussion of general program patterns in section patterns:closure.


next up previous contents index
Next: Basic abstractions derived from Up: Features of A++ Previous: Lexical Scope   Contents   Start

Georg P. Loczewski 2004-03-05


Impressum und Datenschutz