Paths
A reference is a document of the kind ref. Its value is a path: a list that starts with a root of the context, then one step for each hop.
{ "type": "ref", "value": ["names", "cards", "ids", 1] }The glyphs so far: 17, 2 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
- 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 onenew
- refA computed step: a document with its own kindnewselfnearestwidthtype“panel”
Five roots
Section titled “Five roots”The context is a record with five roots. Each path starts at one of them.
| Root | What it holds | Who sets it |
|---|---|---|
self |
The node that the term is part of | A node of a tree sets it for its parts |
names |
The values that the evaluators around the term bound | A sequence adds last and the name of each step |
world |
The registry of kinds | The host of the evaluation |
event |
The event that started a run | A handler |
caps |
The effects that the term can cause | Each evaluator gives the same set or a smaller set |
The evaluators differ in how they change the context for their parts. The references do not differ: each reference is a walk from a root.
Each step is a question
Section titled “Each step is a question”A step does not carry a meaning of its own. The walk asks the thing that it reached: “what is this key on you?” The question goes up the ladder of the verb deref.
- Own: a node of a tree answers itself. It answers
parentwith the node that holds it, as any other field. - Kind: a kind can name a
derefevaluator for its documents. - Default: a record answers with a field, and a list answers with an item.
A step can also be a document. Then the walker of its kind takes the step. nearest is such a kind: it follows parent until it reaches a node of a type. It is not special. It is a kind with an evaluator.
After each hop, the walk examines what it reached. When that is a reference, the walk follows it until it reaches something else. This is collapse. A cycle of references gives #CYCLE!.
The reference
The context: the walk starts at one of its five roots
The hops
- namesroot{ cards, alias, real }
- cardsdefaultids[78]count2
- idsdefault[78]
- 1default8
A type is a path too
Section titled “A type is a path too”The type of a document is a reference into the world: "add", or ["math", "product"]. A namespace groups kinds, and an alias is a reference to another kind. The walk follows an alias by collapse. A text or a list of keys in the field type is a base reference that the kernel resolves itself. Thus the chain of types stops there, and it does not expand forever.
The world of a sandbox is smaller. A path that the world cannot resolve gives #KIND?. Thus the reach of a term is what its world and its context can name.
Shorter forms are possible
Section titled “Shorter forms are possible”A language on top of coeval can accept a shorter form, for example the text $parent.width. Its evaluator changes the short form into a path. The stored document always has the full path with its root, thus no reader guesses.