about summary refs log tree commit diff stats
path: root/066stream.mu
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-06-17 00:05:38 -0700
committerKartik Agaram <vc@akkartik.com>2018-06-17 00:29:22 -0700
commitdd66068298b0a11f2a1f195376cba98e0c8570b5 (patch)
tree06696728fd65cdf38a2ac571943e130e9d60c333 /066stream.mu
parentb89b822439f47a490a1b764e14a1ed1b73059cba (diff)
downloadmu-dd66068298b0a11f2a1f195376cba98e0c8570b5.tar.gz
4261 - start using literals for 'true' and 'false'
They uncovered one bug: in edit/003-shortcuts.mu
  <scroll-down> was returning 0 for an address in one place where I
  thought it was returning 0 for a boolean.

Now we've eliminated this bad interaction between tangling and punning
literals.
Diffstat (limited to '066stream.mu')
-rw-r--r--066stream.mu8
1 files changed, 4 insertions, 4 deletions
diff --git a/066stream.mu b/066stream.mu
index 6d5d0520..86ce26ed 100644
--- a/066stream.mu
+++ b/066stream.mu
@@ -24,7 +24,7 @@ def read in:&:stream:_elem -> result:_elem, empty?:bool, in:&:stream:_elem [
   local-scope
   load-inputs
   assert in, [cannot read; stream has no data]
-  empty? <- copy 0/false
+  empty? <- copy false
   idx:num <- get *in, index:offset
   s:&:@:_elem <- get *in, data:offset
   len:num <- length *s
@@ -32,7 +32,7 @@ def read in:&:stream:_elem -> result:_elem, empty?:bool, in:&:stream:_elem [
   {
     break-unless at-end?
     empty-result:&:_elem <- new _elem:type
-    return *empty-result, 1/true
+    return *empty-result, true
   }
   result <- index *s, idx
   idx <- add idx, 1
@@ -43,7 +43,7 @@ def peek in:&:stream:_elem -> result:_elem, empty?:bool [
   local-scope
   load-inputs
   assert in, [cannot peek; stream has no data]
-  empty?:bool <- copy 0/false
+  empty?:bool <- copy false
   idx:num <- get *in, index:offset
   s:&:@:_elem <- get *in, data:offset
   len:num <- length *s
@@ -51,7 +51,7 @@ def peek in:&:stream:_elem -> result:_elem, empty?:bool [
   {
     break-unless at-end?
     empty-result:&:_elem <- new _elem:type
-    return *empty-result, 1/true
+    return *empty-result, true
   }
   result <- index *s, idx
 ]