 <PRIVATE
 
 : wait ( channel -- )
-    [ channel-senders push ] curry
+    [ senders>> push ] curry
     "channel send" suspend drop ;
 
 : (to) ( value receivers -- )
     delete-random resume-with yield ;
 
 : notify ( continuation channel -- channel )
-    [ channel-receivers push ] keep ;
+    [ receivers>> push ] keep ;
 
 : (from) ( senders -- )
     delete-random resume ;

!
! Channels - based on ideas from newsqueak
USING: kernel sequences sequences.lib threads continuations
random math ;
IN: channels

TUPLE: channel receivers senders ;

PRIVATE>

M: channel to ( value channel -- )
    dup receivers>>
    dup empty? [ drop dup wait to ] [ nip (to) ] if ;

M: channel from ( channel -- value )
    [
        notify senders>>
        dup empty? [ drop ] [ (from) ] if
    ] curry "channel receive" suspend ;
