Direction
The direction of data is the direction of the references that a construct permits. Three shapes cover the languages that coeval serves.
The glyphs so far: 23, 3 new on this page
- 42Data: a value without a type
- numberA document: the tab is its type42
- numberA dashed tab: the container declares the type42
- addParts: a card inside a cardnumber1number2
- kindA kind: a document of type kind
- OKDA rung: own, kind or default
- 3A port: the result of a document
- 0A sealed part: an evaluator cannot read it
- #NAME?An error value, in a red port
- numberaA name tag: a binding for later steps3
- refA reference: a path from a root of the contextnamesa
- A dashed blue arrow: from a reference back to the step with its name
- ifNot evaluated: a part that its parent did not need“yes”testbooltruetruethentext“yes”“yes”elsetext“no”not evaluated
- ▸logThe run side: a magenta edge, and an effect“hi”text“hi”“hi”
- 1log“hi”An effect: a numbered ticket in the world
- logA capability: an effect that a term can cause
- selfnamesThe five roots of a context: each path starts at one
- refA computed step: a document with its own kindselfnearestwidthtype“panel”
- A solid slate arrow: one move of a path, with the text of its step
- collapseA dashed rung: the walk follows a reference to its target (collapse)
- An orange solid arrow: data and the box go down a treenew
- A teal dotted arrow: a size or an event goes up a treenew
- A fuchsia dashed arrow: a reference goes sideways, to another branchnew
- 1adda3number11number22
- 2multiplyb30refnamesa3number1010
- 3▸log30refnamesb30
- 4addc33refnamesa3refnamesb30
What step 4 can name
It can name a, b. No named step comes after it.
Back, in a sequence
Section titled “Back, in a sequence”A step of a sequence can name each earlier step. It cannot name a later step. This is the scope of let*: each binding sees the bindings before it.
Moves, from a focus
Section titled “Moves, from a focus”A formula over a structure reads by position. It starts at a focus and moves: to the parent, to the children, or to the nearest node of a kind. A spreadsheet reads cells in the same way. The diagram builds the tree as documents, and the kernel resolves each path from self. The kernel has no step for all of the siblings, the ancestors or the descendants yet.
Down, up and sideways, in a tree
Section titled “Down, up and sideways, in a tree”In a tree of components, data and the box of a parent go down. The size of a child and its events go up. A reference goes sideways, to another branch. The theory of attribute grammars names these inherited, synthesized and reference attributes.
In coeval, a node of a tree (panel or box) is a decorated tree. Each field of a node is an attribute:
- The structure comes first. The parent, the children and the siblings exist before any attribute evaluates.
- An attribute evaluates when something reads it, one time in each evaluation. A memo keeps its result.
- A child reads its parent with
["self", "parent", "width"], and a sibling with["self", "parent", "children", 0, "width"]. - An attribute that reads itself, also through other attributes, gives
#CYCLE!. The reason gives the chain of attributes. - A failed attribute keeps its own error. A reference to it gives the same code, reason and place.
- An attribute causes no effect, because the order of the reads is not the order of the document.
Select a tree. The model evaluates it, and the diagram numbers each attribute in the order of its evaluation.
The attribute width of box at [children, 0]
{
"type": "add",
"value": [
{
"type": "ref",
"value": ["self", "parent", "width"]
},
-20
]
}It evaluated as number 4, one time.
{"width":300,"height":60,"children":[{"width":280,"height":40}]}One path grammar
Section titled “One path grammar”A name is also a position. A variable is a path up the program to the place of its binding. The previous step is a path to the sibling before. Thus one grammar of paths can name all three shapes. A path is a list of moves from the place of the reference.