Handbook
Glossary
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
value
an
object
key
a variable, by convention a symbol
quot
a
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
USING:
hashtables
kernel
;
IN:
namespaces
:
with-variable
( value key quot -- )
[
associate
]
dip
with-variables
;
inline