Schedules
A schedule answers one question: something changed, so what runs, and in which order? coeval keeps this question out of the meaning of a document. The meaning says what a value is. The schedule says when to compute it.
Four schedules
Section titled “Four schedules”| Schedule | When it computes | Where it fits |
|---|---|---|
| Pull | When a reader asks for a value. A change only marks the readers as old. | Signals in a browser |
| Push | When a value changes. Its readers compute in the order of the graph, until the values stop changing. | A reactive store with epochs |
| Demand | When a cell is read, one time for each run, with a check for cycles | A spreadsheet |
| Once | One time, in the written order | A server, or a command line |
Try the four schedules
Section titled “Try the four schedules”Three formula cards read the inputs a and b. Change a, then read a cell. Each column is one schedule. A lit cell computed in the last step, and a count shows how many times each cell computed.
Push
A change computes each reader at once, in the order of the graph.
Computations: 0
Pull
A change marks the readers as old. A read computes what is old.
Computations: 0
Demand
Each read computes what it needs, one time for each cell.
Computations: 0
Once
Each read computes each cell again, as a page that a server renders.
Computations: 0
The rule
Section titled “The rule”For the derive side, each schedule gives the same values. This is the benefit of pure work. Thus each host can choose its own schedule. A browser can pull, a store with epochs can push, and a server can compute a page once.
For the run side, the program itself gives the order. The schedule only starts the run on its trigger.
What the schedule needs from coeval
Section titled “What the schedule needs from coeval”A schedule needs two things:
- The graph of the data. Each kind declares what it reads, in its contract. From the contracts, a tool can make the graph of a document before it runs.
- The side of each kind. A schedule can repeat derive work, and it must not repeat a run.
From the graph, a static analysis gives three results before the start. It finds the cycles, an order for a push schedule, and the independent groups of nodes. Independent groups can compute at the same time.