with-scope ( quot -- ) (original) (raw)
with-scope ( quot -- )
Factor handbook » The language » Dynamic variables » Namespace combinators
Next: | with-variable ( value key quot -- ) |
---|
Vocabulary
namespaces
Inputs
quot | a quotation |
---|
Outputs
None
Word description
Calls the quotation in a new namespace. Any variables set by the quotation are discarded when it returns.
Examples
USING: math namespaces prettyprint ; IN: scratchpad SYMBOL: x 0 x set [ x [ 5 + ] change x get . ] with-scope x get .
5 0
Definition
: with-scope ( quot -- ) 5 swap with-variables ;
inline