[previous] [up] [next]     [contents] [index]
Next: Custodians Up: Parameterizations Previous: Parameterization Utilities

Specifying a Parameterization

(current-parameterization) returns the current parameterization for the current thread, and (current-parameterization p) installs the parameterization p as the current parameterization for the current thread. Note that current-parameterization is not itself a parameter.

(in-parameterization p param) returns a new procedure that acts like a parameter, but gets and sets values for the parameter param in the parameterization p instead of in the current parameterization.

(with-parameterization p thunk) uses p as the current parameterization while the thunk procedure is applied. Before thunk is invoked, p is installed as the current parameterization. After thunk returns (or when control escapes from thunk via an exception or the application of a continuation), the parameterization that was current before evaluation the with-new-parameterization expression is restored as the current parameterization. The result of calling with-parameterization is the result of invoking thunk.

(with-new-parameterization thunk) creates a new parameterization and passes it on with thunk to with-parameterization. The new parameterization is created using the current parameterization as the base. The result of calling with-new-parameterization is the result of invoking thunk.



PLT