Next: , Previous: , Up: Scheme reference   [Contents][Index]


4.7 Fluids

A fluid is a variable whose value is associated with the dynamic extent of a procedure call. The (hoot fluids) module implements Guile’s fluid API. See the Guile manual for more detailed information.

Procedure: make-fluid [default #f]

Return a new fluid whose initial value is default.

Procedure: fluid-ref fluid

Return the value currently stored within fluid.

Procedure: fluid-set! fluid val

Set the contents of fluid to val.

Procedure: with-fluid* fluid val thunk

Call thunk, a procedure of zero arguments, in a context where the fluid is set to val. When control leaves the dynamic extent of thunk, fluid is set back to its previous value.

Syntax: with-fluids ((fluid value) ...) body1 body2 ...

Evaluate body1 body2 … in a context where each fluid is set to its respective value.