Lexical variables
Factor handbook ยป The language

Prev:Co-operative threads
Next:Dynamic variables


The locals vocabulary provides lexically scoped local variables. Full closure semantics, both downward and upward, are supported. Mutable variable bindings are also provided, supporting assignment to bindings in the current scope or in outer scopes.
Examples of lexical variables

Word definitions where the inputs are bound to lexical variables:
::

M::

MEMO::

MACRO::


Lexical scoping and binding forms:
[let

:>


Quotation literals where the inputs are bound to lexical variables:
[|


Additional topics:
Lexical variables in literals
Mutable lexical variables
Lexical variables and fry
Limitations of lexical variables

Lexical variables complement Dynamic variables.