with-scope ( quot -- )
Factor documentation > Factor handbook > The language > Dynamic variables > Namespace combinators
Prev:make-assoc ( quot exemplar -- hash )
Next:with-variable ( value key quot -- )


Vocabulary
namespaces

Inputs and outputs
quota quotation


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
USING: hashtables kernel ;

IN: namespaces

: with-scope ( quot -- ) 5 <hashtable> swap with-variables
; inline