about summary refs log tree commit diff stats
path: root/apps/ex7
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-07-29 21:41:29 -0700
committerKartik Agaram <vc@akkartik.com>2020-07-29 21:41:29 -0700
commitbae22d720f6a6f3922c29cd7dc4218c7564bbed9 (patch)
tree955d9b13dbeec75a6b0fef6dddb9638c0c9c4d80 /apps/ex7
parent129bb8117b02956714c1be124c7ce0f27393726c (diff)
downloadmu-bae22d720f6a6f3922c29cd7dc4218c7564bbed9.tar.gz
6684 - experimental primitives for streams
This is a hacky special case. The alternative would be more general support
for generics.

One observation: we might be able to type-check some primitives using `sig`s.
Only if they don't return anything, since primitives usually need to support
arbitrary registers. I'm not doing that yet, though. It eliminates the
possibility of writing tests for them in mu.subx, which can't see 400.mu.
But it's an alternative:

  sig allocate out: (addr handle _)
  sig populate out: (addr handle array _), n: int
  sig populate-stream out: (addr handle stream _), n: int
  sig read-from-stream s: (addr stream _T), out: (addr _T)
  sig write-to-stream s: (addr stream _T), in: (addr _T)

We could write the tests in Mu. But then we're testing behavior rather
than the code generated. There are trade-offs. By performing type-checking
in mu.subx I retain the option to write both kinds of tests.
Diffstat (limited to 'apps/ex7')
0 files changed, 0 insertions, 0 deletions