Emute-Lab-Instruments / uSEQ

20 stars 0 forks source link

only stream serial when it's defined #81

Closed chriskiefer closed 4 months ago

chriskiefer commented 5 months ago

if the function is empty, we should not send serial, rather than sending zeros as this uses up bandwidth:

options (1) if parse finds an empty string - return value.error (2) as above, but make a value.undefined (3) something else

monkey-w1n5t0n commented 5 months ago

Good point; I'm not entirely clear on what the intended UX for serial outs is, both for the user and for the downstream modules, and so I wasn't sure what to do with it and whether no output was semantically different to outputting zeros.

At the moment, parsing an empty string returns an empty Value that has a type of UNIT, but it's not clear to me what the semantics of that is supposed to be. Traditionally, the empty value is called 'nil' in Lisp-like languages, but that is parsed from the literal "nil" itself (and is also typically returned by functions without an explicit return parameter - the equivalent of void in C-like languages).

It seems to me that there needs to be a semantic distinction between parsing "" and "nil" - the former is an empty program, while the latter is a program that explicitly states the absence of a value.

For now, I've made the following changes that should fix it (I'm away from the module atm so I haven't tested it yet):