]> gitweb.factorcode.org Git - factor.git/commitdiff
namespaces: rename namestack* to (get-namestack) for consistency.
authorJohn Benediktsson <mrjbq7@gmail.com>
Fri, 14 Aug 2015 00:53:07 +0000 (17:53 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Fri, 14 Aug 2015 00:53:07 +0000 (17:53 -0700)
basis/bootstrap/compiler/compiler.factor
basis/compiler/tests/alien.factor
core/namespaces/namespaces-docs.factor
core/namespaces/namespaces.factor

index 7b7692ef701efa3252064b525b1373d7561ed579..5a0a6a82dba9e97ac48d7e135d2d531c9ee1f4dd 100644 (file)
@@ -60,7 +60,7 @@ gc
 
         wrap probe
 
-        namestack*
+        (get-namestack)
 
         layout-of
     } compile-unoptimized
index a103f29131d451793ffbaccfa8ea6269ec72ec4f..d3e1dfbf5d702f72533a0a2b71da2f9dc0e5c848 100755 (executable)
@@ -358,9 +358,9 @@ FUNCTION: ulonglong ffi_test_38 ( ulonglong x, ulonglong y )
 
 { t 3 5 } [
     [
-        namestack*
+        (get-namestack)
         3 "x" set callback-3 [ callback_test_1 ] with-callback
-        namestack* eq?
+        (get-namestack) eq?
         "x" get "x" get-global
     ] with-scope
 ] unit-test
index 66aaf1738eecbd7f63f6259a3269868e99ee5591..b666c6be39bc3af58a08217349ffdeea9cc0339b 100644 (file)
@@ -66,11 +66,11 @@ ABOUT: "namespaces"
 
 HELP: get
 { $values { "variable" "a variable, by convention a symbol" } { "value" { $maybe "the value" } } }
-{ $description "Searches the name stack for a namespace containing the variable, and outputs the associated value. If no such namespace is found, outputs " { $link f } "." } ;
+{ $description "Searches the namestack for a namespace containing the variable, and outputs the associated value. If no such namespace is found, outputs " { $link f } "." } ;
 
 HELP: set
 { $values { "value" "the new value" } { "variable" "a variable, by convention a symbol" } }
-{ $description "Assigns a value to the variable in the namespace at the top of the name stack." }
+{ $description "Assigns a value to the variable in the namespace at the top of the namestack." }
 { $side-effects "variable" } ;
 
 HELP: off
@@ -165,27 +165,27 @@ HELP: set-global
 { $description "Assigns a value to the variable in the global namespace." }
 { $side-effects "variable" } ;
 
-HELP: namestack*
+HELP: (get-namestack)
 { $values { "namestack" "a vector of assocs" } }
-{ $description "Outputs the current name stack." } ;
+{ $description "Outputs the current namestack." } ;
 
 HELP: get-namestack
 { $values { "namestack" "a vector of assocs" } }
-{ $description "Outputs a copy of the current name stack." } ;
+{ $description "Outputs a copy of the current namestack." } ;
 
 HELP: set-namestack
 { $values { "namestack" "a vector of assocs" } }
-{ $description "Replaces the name stack with a copy of the given vector." } ;
+{ $description "Replaces the namestack with a copy of the given vector." } ;
 
 HELP: >n
 { $values { "namespace" assoc } }
-{ $description "Pushes a namespace on the name stack." } ;
+{ $description "Pushes a namespace on the namestack." } ;
 
 HELP: ndrop
-{ $description "Pops a namespace from the name stack." } ;
+{ $description "Pops a namespace from the namestack." } ;
 
 HELP: init-namespaces
-{ $description "Resets the name stack to its initial state, holding a single copy of the global namespace." }
+{ $description "Resets the namestack to its initial state, holding a single copy of the global namespace." }
 $low-level-note ;
 
 HELP: initialize
index 44029cdfa17b240b8b097e53215e739e58317f8f..0a4f6e41733d0588974e385a454d31527b1864c1 100644 (file)
@@ -31,39 +31,44 @@ M: global-hashtable set-at
 M: global-hashtable delete-at
     box-at f swap value<< ; inline
 
-: namestack* ( -- namestack )
+: (get-namestack) ( -- namestack )
     CONTEXT-OBJ-NAMESTACK context-object { vector } declare ; inline
 
-: >n ( namespace -- ) namestack* push ;
+: (set-namestack) ( namestack -- )
+    CONTEXT-OBJ-NAMESTACK set-context-object ; inline
 
-: ndrop ( -- ) namestack* pop* ;
+: >n ( namespace -- ) (get-namestack) push ;
+
+: ndrop ( -- ) (get-namestack) pop* ;
 
 PRIVATE>
 
 : global ( -- g )
     OBJ-GLOBAL special-object { global-hashtable } declare ; foldable
 
-: namespace ( -- namespace ) namestack* last ; inline
-: get-namestack ( -- namestack ) namestack* clone ;
-: set-namestack ( namestack -- )
-    >vector CONTEXT-OBJ-NAMESTACK set-context-object ;
+: namespace ( -- namespace ) (get-namestack) last ; inline
+: get-namestack ( -- namestack ) (get-namestack) clone ;
+: set-namestack ( namestack -- ) >vector (set-namestack) ;
 : init-namespaces ( -- ) global 1array set-namestack ;
-: get ( variable -- value ) namestack* assoc-stack ; inline
-: set ( value variable -- ) namespace set-at ;
-: change ( variable quot -- ) [ [ get ] keep ] dip dip set ; inline
-: on ( variable -- ) t swap set ; inline
-: off ( variable -- ) f swap set ; inline
+
 : get-global ( variable -- value ) global box-at value>> ; inline
 : set-global ( value variable -- ) global set-at ; inline
 : change-global ( variable quot -- )
     [ [ get-global ] keep ] dip dip set-global ; inline
+: counter ( variable -- n ) [ 0 or 1 + dup ] change-global ; inline
+: initialize ( variable quot -- ) [ unless* ] curry change-global ; inline
+
+: get ( variable -- value ) (get-namestack) assoc-stack ; inline
+: set ( value variable -- ) namespace set-at ;
+: change ( variable quot -- ) [ [ get ] keep ] dip dip set ; inline
+: on ( variable -- ) t swap set ; inline
+: off ( variable -- ) f swap set ; inline
 : toggle ( variable -- ) [ not ] change ; inline
 : +@ ( n variable -- ) [ 0 or + ] change ; inline
 : inc ( variable -- ) 1 swap +@ ; inline
 : dec ( variable -- ) -1 swap +@ ; inline
+
 : with-variables ( ns quot -- ) swap >n call ndrop ; inline
-: counter ( variable -- n ) [ 0 or 1 + dup ] change-global ; inline
 : with-scope ( quot -- ) 5 <hashtable> swap with-variables ; inline
 : with-variable ( value key quot -- ) [ associate ] dip with-variables ; inline
 : with-global ( quot -- ) [ global ] dip with-variables ; inline
-: initialize ( variable quot -- ) [ unless* ] curry change-global ; inline