Sun Nov 20 08:05:56 EST 2011
Streams - Named outputs
So... Where does the stream combinator go? Actually the real problem
is named outputs, or unbound variables in the Oz sense.
Where does it go? Should it be part of the Term language? Should I
expose arrays, or maybe just "ports" or some other bind operator?
Should this mimick the array monads in Haskell?
The main question seems to be: do we keep side-effects out of Term or
not? At some point there are going to be things like delay lines that
could be implemented as assignment, or hidden behind some operator.
One thing is clear: the Language.C AST is a lot more complicated to
work with than the Term syntax. Moreover, the typed frontend will
prevent access to unmanaged assignments, so maybe it's best to just
add set! to Term?
What about this change:
- Use only a single Var type for: values, functions, lvalues (output ports).
- Distinguish by Ref, FRef, PRef.
I did this:
- One Var
- One Ref
- A dumb Write statement in Term, directly translated to deref +
assignment in PrettyC
So PrettyC is dumb, and management of assignment needs to happen on
the typed level that generates the Term structures.