From 49424b1933051b6cf1ce3371ada9cd7fa2d31df0 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Fri, 15 Jan 2021 21:11:43 -0800 Subject: 7523 There's a dependency cycle here: - draw-grapheme (Mu) uses read-grapheme (Mu) to be unicode-aware. - read-grapheme uses read-byte (SubX). Streams are a fundamental data structure in Mu. For the Mu compiler to be able to reason about the safety of stream operations, they need to be an opaque type. All stream primitives are written in SubX. To manipulate a stream's internals we force people to reach for SubX. That way if there's no SubX code there's confidence that things are safe. - read-byte and other stream operations have unit tests, like they should. The unit tests need to print data to screen when say a test fails. To do this they use various check- functions (SubX) that take a string argument. - Printing a string to screen uses draw-grapheme (Mu). Perhaps I should maintain variants of drawing primitives that operate only on ASCII. --- baremetal/106stream.subx | 3 +++ 1 file changed, 3 insertions(+) (limited to 'baremetal/106stream.subx') diff --git a/baremetal/106stream.subx b/baremetal/106stream.subx index 84d0580b..9949ee7d 100644 --- a/baremetal/106stream.subx +++ b/baremetal/106stream.subx @@ -8,6 +8,9 @@ # some primitives for operating on streams: # - clear-stream (clears everything but the data size) # - rewind-stream (resets read pointer) +# +# We need to do this in machine code because streams need to be opaque types, +# and we don't yet support opaque types in Mu. == code # instruction effective address register displacement immediate -- cgit 1.4.1-2-gfad0