Skip to content

Context

A term is not alone. A formula reads its parent, a step reads an earlier step, and a handler reads its event. Each of these reads goes through one door, the context. A context has five parts.

The glyphs so far: 15, 3 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 effectnew
  • 1log“hi”An effect: a numbered ticket in the worldnew
  • logA capability: an effect that a term can causenew
Part What a reference through it reaches
Names A value that a binding gives: a let, a parameter or the result of an earlier step
Focus A position in a structure: the node itself, its parent, its children or its siblings
World A stored document or collection, by an absolute ID or by a query
Event The trigger of a run, and its values
Capabilities The effects that the term can cause

Most declarative languages have the same core: a literal, a reference, a call, a binding, a condition and a loop. They differ in the context. Select a construct to see how it uses each part.

Construct

run: effects in order A list of steps. A step can read the result of each earlier step by its name.

The term
{
  "type": "seq",
  "value": [
    {
      "type": "store.find",
      "value": {
        "match": { "board": "b1" }
      },
      "name": "cards"
    },
    {
      "type": "store.patch",
      "value": {
        "ids": {
          "type": "ref",
          "value": "cards.ids"
        },
        "set": { "done": true }
      }
    }
  ]
}
Names
reads
more names
The result of each step is a name for the later steps.
Focus
not read
nothing
It does not use this part.
World
reads
same
A step reads and writes the store through a procedure.
Event
not read
same
The steps get the event of the run without a change.
Capabilities
reads
smaller
A nested call gets the same capabilities or fewer.

All six constructs. Select a row to see it above.

ConstructSideNamesFocusWorldEventCapabilities
Formuladerivereads, gives more namesreads, gives new positionnot usednot usednot used
Sequencerunreads, gives more namesnot usedreads, gives samepasses, gives samereads, gives smaller
Tree nodederivereads, gives more namesreads, gives new positionreads, gives samenot usednot used
Layout rulederivereads, gives nothingreads, gives nothingnot usednot usednot used
Event handlerrunreads, gives samereads, gives samereads, gives samereads, gives new valuereads, gives smaller
Queryderivereads, gives nothingnot usedreads, gives nothingnot usednot used
A term reaches outside itself only through these five parts. The constructs differ in which parts they read, and in what they give the parts of their body. A pure construct gives its parts no capability.

Each construct reads some parts, and it gives the parts of its body a context. It can give the same value, more names, a new position, a smaller set of capabilities or a new value. A pure construct gives its body no capability. A run gives its body the same capabilities or fewer, and not more at any time.