Unlike module bindings, local bindings are established during program execution, each time the local declaration is executed. They persist for as long as code in their scope is active. Local bindings persist after the body containing them returns if they are referenced by a method created inside the body and a reference to the method escapes from the body, so that it could be called after the body returns. Unlike module bindings, local bindings are always variable. However, since a local binding has a limited scope, if there is no assignment within that scope, the local binding is effectively constant.
A local binding shadows any module binding with the same name and any surrounding local binding with the same name. The innermost binding is the one referenced.
The name of a local binding cannot be the name of a macro.
There are three kinds of local declaration: local value bindings (
let), local method bindings (
local), and condition handler establishment (
The local value bindings construct,
let, executes an expression and locally binds names to the values returned by that expression.
The local method bindings construct,
local, locally binds names to bare methods. These bindings are visible in the remainder of the body and also inside the methods, permitting recursion.
The condition handler establishing construct,
let handler, establishes a function to be called if a condition of a given type is signaled during the execution of the remainder of the body or anything the body calls. The handler is disestablished as soon as the body returns. Unlike the other two kinds of local declaration,
let handler does not establish any bindings.
Generated with Harlequin WebMaker