Expand description
The static dependency graph a fine-grained DOM update is compiled from.
Stage A repaints a component by clearing its mount and rebuilding the subtree — correct, and O(the whole view) for a change to one field. Stage B emits a PATCHER instead, and a patcher needs three facts known before the program runs:
- every SITE in the view that can change, and which state fields it reads;
- every ACTION, and which state fields it writes;
- every DERIVED field, and what it is derived from.
Then a turn that writes draft updates exactly the sites that read draft.
★ THE READ SET IS CLOSED, which is the whole difficulty and the whole value. The names a site LITERALLY MENTIONS are usually not state:
{remaining}whereremainingis derived reads whatever the derivation reads — nothing ever writesremainingitself, so a literal read set would never update it;{t}inside{for each t in todos:}readstodos—tis a window onto state, not state, and no action writes it;{doubled}after{let doubled be n * 2}readsn.
Every one of those failures is SILENT: the page simply stops updating, on exactly the constructs real pages are built from. So resolution happens here, once, and the answer a site carries is already in terms of the fields an action can write.
★ The write set is a static OVER-approximation on purpose. A write inside an If counts even
when the branch does not run: repainting a site that did not change is a wasted patch, while
missing one leaves a visitor looking at a stale page. The two errors are not comparable.
Structs§
- Component
Deps - The whole graph for one component.
- Site
Deps - One addressable place in a view that can change, and what it depends on.
Enums§
- DepError
- Why a component has no dependency graph.
- Site
Kind - What kind of thing a site is — which decides what the patcher emits for it.
Functions§
- block_
prop_ writes - The PROPS a block writes — every one a mistake, since a prop is the parent’s value.
boundare the names the block’s own header binds (an action’s parameters, a trigger’s values), which shadow a prop of the same name. The same walk asblock_writes, so a verb that writes state is a verb that writes a prop. - block_
writes - The state fields one block of statements writes — the same walk
component_depsuses for an action, exposed so a lowering can ask about a body it is about to emit. - component_
deps - Build the dependency graph for one component.