Skip to content

Documents

Each picture on this site is made of a small set of glyphs. This page gives the first four. Each later page adds one or two glyphs, and it uses all of the glyphs before it. Thus a large picture is made of the same parts as a small picture.

The glyphs so far: 4, 4 new on this page
  • 42Data: a value without a typenew
  • number
    42
    A document: the tab is its typenew
  • number
    42
    A dashed tab: the container declares the typenew
  • add
    number
    1
    number
    2
    Parts: a card inside a cardnew

Data is a JSON value: a number, a text, a truth value, a list or a record. Data has no type of its own. Its glyph is the value alone.

A document puts a value in an envelope: { "type": "number", "value": 42 }. The envelope names the type, and it does not change the value. The card is the envelope. Its tab is the type, and its body is the value.

The envelope can also hold a header: a name for a binding, and own entries that change one document. The later pages use both.

A value can get a type in four common ways. Select a value to compare them.

Tag
WayJSONTags any valueKeeps the valueRoom for a headerType without a guess
A reserved key in the value{"type":"alert","text":"low disk"}yesA record can hold the key.noThe value has its own field type. The tag overwrites it.noA name or an own entry needs one more reserved key.yesThe key gives the type.
An envelope: { type, value }{"type":"alert","value":{"type":"warning","text":"low disk"}}yesThe value can be any JSON value.yesThe value is never changed.yesA name and own entries go beside type.yesThe envelope gives the type.
The type as the only key{"alert":{"type":"warning","text":"low disk"}}yesThe value can be any JSON value.yesThe value is not changed.noThe record has one key only. A name has no place.yesThe key gives the type.
No tag: the shape decides{"type":"warning","text":"low disk"}noThere is no tag.yesThe value is not changed.noThere is no header.noA guess from the fields gives the type. Two shapes can match.

The envelope, drawn as a card

alert
type“warning”text“low disk”
alertownmine
type“warning”text“low disk”

The tab is the type. The body is the value, as it was. The second card has a header with a name and an own entry.

Only the envelope gets four times yes. It costs one level of nesting. A position that declares its type can hold a bare value, thus the nesting is necessary only where the type is open.

A list of numbers does not need an envelope for each number. The kind of the list declares the type of its items. Such a value is bare, and its card has a dashed tab.

The first two numbers are bare. The list of add gives them the type number. The third number has its own envelope. Typed languages work in the same way: a declaration gives a type, and only an open position needs a tag.

One record can be in three lists, with three declared types. Each list gives the record a different meaning.

The kind comes from

The same record, in three lists

Each dashed tab is a type that its list declares. The record itself does not change.

ListKindEvaluatorResult
photos
A picture of 120 by 80
imageimage.view
frames
An empty box of 120 by 80
boxbox.view
upload rules
The largest size that an upload can have
limitlimit.view120 × 80 at most
By name: each list declares the kind of its items. The same record gets three different meanings, and each one is correct.

A document can hold other documents. They are its parts, and their cards are inside its card. The kind of a document tells where its parts are. The next page shows the kinds.