I'm actually looking for a system that allows me to write Javascript code in the normal imperative way, and automatically makes it reactive.
So, for example, calling a function f(a, b) is first done normally, and then, when e.g. "b" changes value, the function f(a, b) is re-evaluated incrementally. Note that this means that not simply f is invoked again, but that f is recursively re-evaluated.
Anybody here aware of such a system?
I know there is research in this area ([1]). I would really like to use such a system in Javascript.
I think what you are looking for is called auto-lifting. That is, automatically lifting functions into reactive streams.
While it sounds like an awesome idea, things get crazy really fast. It's hard to explain briefly, but make it explicit and clear to the programmer which things are reactive streams and which are simply values makes it much easier to predict what the program is doing.
In my opinion, the current way of doing things with reactive mechanisms really doesn't make it clear what the program is doing. There's lots of things happening at the same time, and also glitches can occur (variables rapidly changing after eachother), and also non-optimal efficiency (things being recomputed unnecessarily).
If my program just gets re-evaluated in an optimal way (without any other side-effects) then that would make my life much simpler.
The research I linked to already states that it can be done. So I was wondering if there are any Javascript implementations yet out there.
SAC is quite different from reactive programming in the sense that it is not, well, reactive or interactive. SAC deals with incremental recomputation on change, whereas most reactive programming systems out their don't support incremental recomputation (maybe some DOM diffing and that's about it).
Check out Adapton though, which is trying to bridge the gap.
That sounds like another language, or some sort of javascript processor that would wrap all functions and variables with magic... I haven't personally heard of anything like that, and can imagine lots of drawbacks (mostly about memory) for it.
So, for example, calling a function f(a, b) is first done normally, and then, when e.g. "b" changes value, the function f(a, b) is re-evaluated incrementally. Note that this means that not simply f is invoked again, but that f is recursively re-evaluated.
Anybody here aware of such a system?
I know there is research in this area ([1]). I would really like to use such a system in Javascript.
[1] http://www.umut-acar.org/publications-by-topic#TOC-Self-Adju...