Features · Reactive

Reactive

Program's core idea: you declare what a value is in terms of other values, and the runtime keeps it current.

Declare, don't update

There is no separate step that says when to recompute: the dependency is the instruction. State is something you write; everything else is derived from it.

STATE Maths.Integer count = 0
LET Text label = Maths.Integer.ToString count

count is state you can write; label is derived from it. Change count and label recomputes on its own. Nothing calls it. The same rule drives effects, context and the interface, so the whole program stays in step with itself.

A graph of values

Each LET reads some values and produces another, so a program is a graph: state at the roots, derived values hanging off it, the interface at the leaves. The runtime holds that graph, so a write does not re-run the program — it recomputes only the values that actually depended on what changed and reuses the cached result for everything else.

count STATE label LET interface UI
Write count and only the path that depends on it settles, in order.

The interface is a value

The interface is not drawn by hand and then kept in sync; it is itself a value derived from state, recomputed by the same rule as everything else. Effects and context work the same way. There is one model to learn, and the only thing that can ever be stale is nothing at all, because there is no separate update step to forget to call.