Expand description
What a program is: its steps and state (program), the values it is
run with (values), the operations its steps are of (operation,
operation_registry), the part it builds (part, target,
reader, element), the parts of other programs it places
(placed), how it is run (runner), the files around it
(workspace) and what their texts were made into (cache), and numbers given as formulas of its parameters
(numeric). It knows no operation: those are defined by the crates
built on it, and no target type but a parameter’s.
§The run model
A part is a memo table with one kind of node: what one step produced of
one target, keyed by the step’s id and the target’s name, never by a
position. A run walks the program’s steps in order; each step only
declares what it produces (part::StepContext::produce), with its
arguments and a plain function, its make, that computes the value
through a reader::Reader. Every read is recorded on the node
(target::Read): which producer’s version of a target, that a target
was absent, the value of an input or of the state, a file’s revision, a
read inside a placed part.
A make runs when its node is new, its arguments differ, or something it read changed; nothing else ever runs. A node made again into an equal value keeps its version, so what read it is reused in turn.
The producer a step sees of a target is the latest step before it in the
program’s order that produces it. A target several steps produce — the
model, the parameters’ values — is a chain (target::Target::CHAIN):
each producer starts from what the one before left
(reader::Reader::previous). Inserting, removing or reordering steps
changes which producer a reader sees, which the recorded reads catch.
A placed part is a node whose value is a built part
(placed::PlacedPart), built from exactly its program, its inputs and
the slice of the state under its name; equal builds are shared, so a
thousand equal screws are one build.
Modules§
- cache
Cache: what the text of a file was made into — a STEP file’s bodies — kept by the workspace, so that a file is made into the same thing once for every build that reads it (a step’s preview, the program it is committed to, a part placed from it in another file), and, with aCacheStore, once for every process. With a store, it keeps what the programs of the workspace built too, so that reopening one whose steps and inputs did not change builds nothing (seecrate::kept).- element
ElementReference: an element of a target by its stable name — an edge or a face of a part’s topology, a line of a sketch — typed by the target it is in and theKindof element it is, as aTargetReferenceis typed by its target. What an operation is given to build on, and what a pick in the viewport becomes (PickedElement).- kept
- What a program built, kept between processes: reopening a program whose steps and inputs did not change builds nothing.
- numeric
NumericInput: a number an operation is given — a length, an angle, a count — typed into a dialog’s number field as a plain value or as a formula of the program’s parameters, which it follows (evaluate). An operation’s arguments take one wherever they take a number. (How a dialog shows one, the editor says.)- operation
- operation_
registry - part
Part: what a program builds, as a memo table — one node per step and target it produces — andStepContext, what a step declares its nodes through (StepContext::produce).- placed
- Placed parts: the part another program builds, placed in a part as a
node of its own (
placed), whose value is the built part (PlacedPart), made bybuild_placed. - program
Program: what a program is, and what a program file holds — its steps, each an operation and its saved arguments, its state: where its placed parts are and how its joints are turned, what solving it changes — and how it is shown (Display). Serialized as{"steps": [...], "state": {...}, "display": {...}}.- reader
Reader: the only way a part is read — by a make, which records every read (Read) on the node it makes, or by an editor, recording nothing.- runner
Runner: runs a program on a part (Runner::run) — every step’s operation, in order, each declaring what it produces — and builds the parts it places, sharing equal builds. What a run made of the targets kept between processes it notes in its workspace’s cache, to be written when the cache is next flushed (seecrate::kept).- target
- What a part holds: targets, by name (
TargetReference), each the value of aTargettype, made by the steps that produce it — one node per step and target ([Node]) — and what a node read while it was made (Read), which says when it can be reused. - values
- The values a program is run with from outside: what a program placing
it sets its parameters to (
Setting), and what its state holds (StateValue): where its placed parts are and how its joints are turned — what a solve moves, kept with the program between runs. Both are saved in a program file, so they are the file format’s, not an operation’s. - watch
- What a long computation has done, for whoever waits for it, and whether they still want it.
- workspace
Workspace: where the programs a program places, and the files its steps read, come from — the one thing a run reads that is not given to it as inputs or state, and not built by its steps — andFiles, a workspace of files read from aFileStore.