diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-01-15 00:00:46 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-01-15 00:00:46 -0800 |
commit | 0d2c3387c59b039ce2dc58ad4545feb04ddc4de4 (patch) | |
tree | 8f87ddd5b5590656e95ea99b27e5132672e4d525 /channel.mu | |
parent | ec6364a0343315c14dfd1b926991b5ccdd1d7542 (diff) | |
download | mu-0d2c3387c59b039ce2dc58ad4545feb04ddc4de4.tar.gz |
571 - screen primitives take an explicit terminal
This will let me swap in a fake in tests. Still hacky, though. I'm sure I'm not managing the parameter right in the chessboard app. And then there's the question of whether it should also appear as an output operand. But it's a start. And using nil to mean 'real' is a reasonable convention. If I ever need to handle multiple screens perhaps we'll have to switch to 1:literal/terminal and 2:literal/terminal, etc. But those are equally easy to guard on.
Diffstat (limited to 'channel.mu')
-rw-r--r-- | channel.mu | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/channel.mu b/channel.mu index 92746a62..ea6c89a8 100644 --- a/channel.mu +++ b/channel.mu @@ -8,9 +8,9 @@ (done?:boolean <- less-than n:integer 5:literal) (break-unless done?:boolean) ; other threads might get between these prints - (print-primitive (("produce: " literal))) - (print-primitive n:integer) - (print-primitive (("\n" literal))) + (print-primitive nil:literal/terminal (("produce: " literal))) + (print-primitive nil:literal/terminal n:integer) + (print-primitive nil:literal/terminal (("\n" literal))) ; 'box' n into a dynamically typed 'tagged value' because that's what ; channels take (n2:integer <- copy n:integer) @@ -31,9 +31,9 @@ ; unbox the tagged value into an integer (n2:integer <- maybe-coerce x:tagged-value integer:literal) ; other threads might get between these prints - (print-primitive (("consume: " literal))) - (print-primitive n2:integer) - (print-primitive (("\n" literal))) + (print-primitive nil:literal/terminal (("consume: " literal))) + (print-primitive nil:literal/terminal n2:integer) + (print-primitive nil:literal/terminal (("\n" literal))) (loop) } ]) |