Next: , Previous: Define-Record-Type, Up: Scheme Syntax Extension Packages


3.9 Fluid-Let

(require 'fluid-let)

Note: fluid-let is not thread-safe. It is better to use Parameter Objects (srfi-39) or Dynamic Data Type, both of which will be made thread-safe in the future.
— Syntax: fluid-let (bindings ...) forms...
     (fluid-let ((variable init) ...)
        expression expression ...)

The inits are evaluated in the current environment (in some unspecified order), the current values of the variables are saved, the results are assigned to the variables, the expressions are evaluated sequentially in the current environment, the variables are restored to their original values, and the value of the last expression is returned.

The syntax of this special form is similar to that of let, but fluid-let temporarily rebinds existing variables. Unlike let, fluid-let creates no new bindings; instead it assigns the values of each init to the binding (determined by the rules of lexical scoping) of its corresponding variable.