Skip to content

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
  • number
    42
    A document: the tab is its type
  • number
    42
    A dashed tab: the container declares the type
  • add
    number
    1
    number
    2
    Parts: a card inside a card
  • 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
  • numbera
    3
    A name tag: a binding for later steps
  • ref
    namesa
    A reference: a path from a root of the context
  • if
    test
    bool
    true
    true
    then
    text
    “yes”
    “yes”
    else
    text
    “no”
    not evaluated
    “yes”
    Not evaluated: a part that its parent did not need
  • ▸log
    text
    “hi”
    “hi”
    “hi”
    The run side: a magenta edge, and an effect
  • 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
  • ref
    self
    nearest
    type“panel”
    width
    A computed step: a document with its own kindnew

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.

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 parent with the node that holds it, as any other field.
  • Kind: a kind can name a deref evaluator 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!.

Reference

The reference

ref
namescardsids1

The context: the walk starts at one of its five roots

selfnamesworldeventcaps

The hops

  1. namesroot{ cards, alias, real }
  2. cardsdefaultids[78]count2
  3. idsdefault[78]
  4. 1default8
The path reaches 8.
The root names holds the values that the evaluators around the reference bound. The default answers each later step: a field, then an item.

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.

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.