about summary refs log tree commit diff stats
path: root/072channel.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-04-27 00:39:49 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-04-27 00:47:23 -0700
commitb61557347aac31e6ba98dedbc16e49a69ff30912 (patch)
tree634342dfc937c8824fcd1a719adebedd9d52eef3 /072channel.mu
parent331f6524488eaee36cc659363b6ba8b12e2b17df (diff)
downloadmu-b61557347aac31e6ba98dedbc16e49a69ff30912.tar.gz
2872 - tangle directive spurious errors fixed
Diffstat (limited to '072channel.mu')
-rw-r--r--072channel.mu28
1 files changed, 9 insertions, 19 deletions
diff --git a/072channel.mu b/072channel.mu
index b70539e9..6fe96e91 100644
--- a/072channel.mu
+++ b/072channel.mu
@@ -62,9 +62,6 @@ def write out:address:sink:_elem, val:_elem -> out:address:sink:_elem [
   load-ingredients
   chan:address:channel:_elem <- get *out, chan:offset
   <channel-write-initial>
-  # BUG: delete next 2 lines after enabling the tangle directives below
-  closed?:boolean <- get *chan, closed?:offset
-  reply-if closed?
   {
     # block if chan is full
     full:boolean <- channel-full? chan
@@ -99,9 +96,6 @@ def read in:address:source:_elem -> result:_elem, in:address:source:_elem [
     empty?:boolean <- channel-empty? chan
     break-unless empty?
     <channel-read-empty>
-    # BUG: delete next 2 lines after enabling the tangle directives below
-    closed?:boolean <- get *chan, closed?:offset
-    reply-if closed?, 0  # hack, will only work for scalar _elem; we need a method to clear arbitrary types
     free-address:location <- get-location *chan, first-free:offset
     wait-for-location free-address
   }
@@ -288,19 +282,15 @@ def close x:address:sink:_elem -> x:address:sink:_elem [
 # if a channel is closed for writing,
 #   future reads continue until the channel empties,
 #   then the channel is also closed for reading
-# BUG: tangle directives on shape-shifting recipes work, but raise spurious warnings 
-#   why this happens: tangling is a transform, and transforms only run during
-#   specialization. however the check that added fragments are used runs
-#   immediately and potentially before any specializations are encountered.
-#? after <channel-write-initial> [
-#?   closed?:boolean <- get *chan, closed?:offset
-#?   reply-if closed?
-#? ]
-#? 
-#? after <channel-read-empty> [
-#?   closed?:boolean <- get *chan, closed?:offset
-#?   reply-if closed?
-#? ]
+after <channel-write-initial> [
+  closed?:boolean <- get *chan, closed?:offset
+  reply-if closed?
+]
+
+after <channel-read-empty> [
+  closed?:boolean <- get *chan, closed?:offset
+  reply-if closed?, 0/hack  # only scalar _elems supported in channels; need to support construction of arbitrary empty containers
+]
 
 ## helpers