3.3 local
(local [definition ...] expr) |
Groups related definitions for use in expr. Each
definition is evaluated in order, and finally the body
expr is evaluated. Only the expressions within the
local form (including the right-hand-sides of the
definitions and the expr) may refer to the names
defined by the definitions. If a name defined in the
local form is the same as a top-level binding, the inner one
“shadows” the outer one. That is, inside the local form,
any references to that name refer to the inner one.
Since local is an expression and may occur anywhere an expression may occur, it introduces the notion of lexical scope. Expressions within the local may “escape” the scope of the local, but these expressions may still refer to the bindings established by the local.