Sun Aug 2 19:14:09 EDT 2020
functional reactive programming
I made a lua and C implementation of a pure reactive network. Maybe
now is a good time to revisit some of the ideas of purity, and why it
would be beneficial as compared to an "event" or message based system.
There is a difference between defining events as messages, and
defining them as implementation details, i.e. updates that happen
behind the scenes, with only an interface to the world where:
- input messages are mapped to value changes, and might stop
propagating if they do not change
- output messages are derived from value changes, and will not happen
if there is no change.
So a pure setup like this feels simpler, as in being just an
implementation of function evaluation and not a messaging system.
But is it actually simpler to develop systems this way?
Once example that has recently come up is in the context of a control
panel, where two knobs have the same function. This might happen
e.g. in a hardware device that also has a software interface, and
turning a knob on the device should have the same effect as turning
the knob on the PC GUI.
This is not really well-defined, as in: what would happen when both
controls are operated simultaneously? But if they are not, then it is
obvious what the semantics is: the knob that is handled is enabled,
and the other one is effectively disconnected.
So how would something like that be implemented at the FRP level?