]> gitweb.factorcode.org Git - factor.git/commitdiff
new accessors
authorDoug Coleman <doug.coleman@gmail.com>
Sun, 31 Aug 2008 07:51:43 +0000 (02:51 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Sun, 31 Aug 2008 07:51:43 +0000 (02:51 -0500)
extra/coroutines/coroutines.factor

index 3fad3adbaade1e5ac4884367f816676925f17ea6..3c1f8490c4d41b534c7d76453b0da6b007ebb9d8 100644 (file)
@@ -1,7 +1,8 @@
 ! Copyright (C) 2005 Chris Double, 2007 Clemens Hofreither.
 ! See http://factorcode.org/license.txt for BSD license.
+USING: kernel hashtables namespaces continuations quotations
+accessors ;
 IN: coroutines
-USING: kernel hashtables namespaces continuations quotations ;
 
 SYMBOL: current-coro
 
@@ -13,12 +14,12 @@ TUPLE: coroutine resumecc exitcc ;
   [ swapd , , \ bind , 
     "Coroutine has terminated illegally." , \ throw ,
   ] [ ] make
-  over set-coroutine-resumecc ;
+  >>resumecc ;
 
 : coresume ( v co -- result )
   [ 
-    over set-coroutine-exitcc
-    coroutine-resumecc call
+    >>exitcc
+    resumecc>> call
     #! At this point, the coroutine quotation must have terminated
     #! normally (without calling coyield or coterminate). This shouldn't happen.
     f over
@@ -31,8 +32,8 @@ TUPLE: coroutine resumecc exitcc ;
   current-coro get
   [  
     [ continue-with ] curry
-    over set-coroutine-resumecc  
-    coroutine-exitcc continue-with
+    >>resumecc
+    exitcc>> continue-with
   ] callcc1 2nip ;
 
 : coyield* ( v -- ) coyield drop ; inline
@@ -40,5 +41,5 @@ TUPLE: coroutine resumecc exitcc ;
 
 : coterminate ( v -- )
   current-coro get
-  [ ] over set-coroutine-resumecc
-  coroutine-exitcc continue-with ;
+  [ ] >>resumecc
+  exitcc>> continue-with ;