namespaces: Way better implementation of with-variable-on.
parent
dd22d6efa4
commit
f3bbc30c8a
|
@ -38,3 +38,7 @@ SYMBOL: toggle-test
|
||||||
|
|
||||||
{ t } [ [ test-initialize get-global ] { at* set-at } inlined? ] unit-test
|
{ t } [ [ test-initialize get-global ] { at* set-at } inlined? ] unit-test
|
||||||
{ t } [ [ test-initialize set-global ] { at* set-at } inlined? ] unit-test
|
{ t } [ [ test-initialize set-global ] { at* set-at } inlined? ] unit-test
|
||||||
|
|
||||||
|
SYMBOL: bool-test
|
||||||
|
{ t } [ bool-test [ bool-test get ] with-variable-on ] unit-test
|
||||||
|
{ f } [ bool-test [ bool-test get ] with-variable-off ] unit-test
|
||||||
|
|
|
@ -67,6 +67,6 @@ PRIVATE>
|
||||||
: with-variables ( ns quot -- ) swap >n call ndrop ; inline
|
: with-variables ( ns quot -- ) swap >n call ndrop ; inline
|
||||||
: with-scope ( quot -- ) 5 <hashtable> swap with-variables ; inline
|
: with-scope ( quot -- ) 5 <hashtable> swap with-variables ; inline
|
||||||
: with-variable ( value key quot -- ) [ associate ] dip with-variables ; inline
|
: with-variable ( value key quot -- ) [ associate ] dip with-variables ; inline
|
||||||
: with-variable-on ( key quot -- ) [ t swap associate ] dip with-variables ; inline
|
: with-variable-on ( key quot -- ) [ t ] 2dip with-variable ; inline
|
||||||
: with-variable-off ( key quot -- ) [ f swap associate ] dip with-variables ; inline
|
: with-variable-off ( key quot -- ) [ f ] 2dip with-variable ; inline
|
||||||
: with-global ( quot -- ) [ global ] dip with-variables ; inline
|
: with-global ( quot -- ) [ global ] dip with-variables ; inline
|
||||||
|
|
Loading…
Reference in New Issue