with-variable ( value key quot -- )
Factor handbook » The language » Dynamic variables » Namespace combinators

Prev:with-scope ( quot -- )
Next:with-variables ( ns quot -- )


Vocabulary
namespaces

Inputs
valuean object
keya variable, by convention a symbol
quota quotation


Outputs
None

Word description
Calls the quotation in a new namespace where key is set to value.

Examples
The following two phrases are equivalent:
[ 3 x set foo ] with-scope

3 x [ foo ] with-variable


Definition