Mon Nov 13 10:53:07 EST 2017
Why are abstract sinks such a good abstraction?
Why is this such a good abstraction compared to left fold?
The problem with left fold for embedded software is the reliance on
allocation to produce the results. While calling a function to
produce a result is abstract, this is not so easy to do in C in an
efficient manner. This would only work well if there were some kind
of linear allocator.
It seems more sense to avoid it all together, and have the iterator do
less: just push elements into some other (stateful) object.
Essentially, it is cheaper to have "multitasking" in C than it is to
have fully abstract function evaluation!
Let's call sinks/sources what they are usually called: channels.
So, doing this at compile time needs a transformation between folds
and channel programming.
It would be interesting to do this first in a language that has
accessible tasks such as Erlang.