about summary refs log tree commit diff stats
path: root/channel.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-04-27 22:28:55 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-04-27 22:28:55 -0700
commit5b22547bb352f6e5a98ddd8ff42f37861a8e16ea (patch)
treecf531cce10d5f570f55dd54a46361dad882a14f6 /channel.mu
parentb1ddb414006352b2d3af3652263a536acbd2702e (diff)
downloadmu-5b22547bb352f6e5a98ddd8ff42f37861a8e16ea.tar.gz
2880
Turns out we don't need a primitive to return an empty value of
arbitrary type. Just create it on the heap using 'new'.

But this uncovered *yet* another bug, sigh. When I specialize generic
functions I was running all transforms on the generated functions after
specialization completed. But there's one transform that includes code
from elsewhere. If such code included type-ingredients -- kaboom. Now
fixed and there's a test, so I've got that going for me which is nice.
Diffstat (limited to 'channel.mu')
-rw-r--r--channel.mu3
1 files changed, 2 insertions, 1 deletions
diff --git a/channel.mu b/channel.mu
index d74cbcad..e7415754 100644
--- a/channel.mu
+++ b/channel.mu
@@ -24,7 +24,8 @@ def consumer source:address:source:character -> source:address:source:character
   load-ingredients
   {
     # read an integer from the channel
-    n:character, source <- read source
+    n:character, eof?:boolean, source <- read source
+    break-if eof?
     # other threads might get between these prints
     $print [consume: ], n:character, [ 
 ]