about summary refs log tree commit diff stats
path: root/channel.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-10-05 18:40:51 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-10-05 18:40:51 -0700
commitd135851ef94bf15f258b779098404ef6adac92b6 (patch)
tree486b24923abc700b3ff2e41d6f9a1220c31e79d7 /channel.mu
parent745e8bdd7ad66ebfb0a282f820c93d3a544b2afe (diff)
downloadmu-d135851ef94bf15f258b779098404ef6adac92b6.tar.gz
2247 - type-check products of non-primitive recipes
We still can't check ingredient types, and even this is still a run-time
check. We'll need to start tracking recipe signatures at some point.

I've had to introduce a hack called /skiptypecheck. Time to get generics
working.
Diffstat (limited to 'channel.mu')
-rw-r--r--channel.mu12
1 files changed, 6 insertions, 6 deletions
diff --git a/channel.mu b/channel.mu
index ffa6d9f6..bc6ee44c 100644
--- a/channel.mu
+++ b/channel.mu
@@ -1,11 +1,11 @@
 # example program: communicating between routines using channels
 
 recipe producer [
-  # produce numbers 1 to 5 on a channel
+  # produce characters 1 to 5 on a channel
   local-scope
   chan:address:channel <- next-ingredient
   # n = 0
-  n:number <- copy 0
+  n:character <- copy 0
   {
     done?:boolean <- lesser-than n, 5
     break-unless done?
@@ -24,9 +24,9 @@ recipe consumer [
   chan:address:channel <- next-ingredient
   {
     # read an integer from the channel
-    n:number, chan:address:channel <- read chan
+    n:character, chan:address:channel <- read chan
     # other threads might get between these prints
-    $print [consume: ], n:number, [ 
+    $print [consume: ], n:character, [ 
 ]
     loop
   }
@@ -36,8 +36,8 @@ recipe main [
   local-scope
   chan:address:channel <- new-channel 3
   # create two background 'routines' that communicate by a channel
-  routine1:number <- start-running producer:recipe, chan
-  routine2:number <- start-running consumer:recipe, chan
+  routine1:character <- start-running producer:recipe, chan
+  routine2:character <- start-running consumer:recipe, chan
   wait-for-routine routine1
   wait-for-routine routine2
 ]