5# Concepts and terminology
7Usually, a new language is an improvement on one you already
8know. If it isn't, it probably at least shares concepts with a
9large family of relatives. These concepts come with words, like
10*type* or *function*, that map cleanly onto its semantics.
12In Hoon we throw away almost all these words and invent new
13ones, which mean almost the same things. But wait, wat?
17Hoon has no close relatives, and the normal jargon of programming
18maps poorly onto its semantics. For example, although Hoon is a
19typed language, the term *type* is not formally defined in Hoon.
20It's a great word, but Hoon has three quite separate concepts
21which could comfortably claim it. We say *type* all the time;
22we mean `span`, or `mold`, or `mark`, or possibly all three.
23Sometimes this is ok and sometimes it isn't.
25Other common programming concepts used only informally in Hoon
26are "function," "object," "event," "expression," "variable,"
27"label," "closure", "environment," "stack," and probably a few
28more. We can get away with any of these conventional words --
29and we do. But when we do, we're making an analogy that relies
30on context for precision.
34Any `word` in code font is a `limb` (label) in the Hoon kernel.
35Any jargon that isn't a limb is in *italics*.
39Top-level Hoon concepts: `noun` (data), `nock` (interpreter),
40`mint` (compiler), `span` (type), `twig` (expression).
46A value in Hoon is called a [`noun`](noun). A noun is either a
47unsigned integer of any size (`atom`), or an ordered pair of any
48two nouns (`cell`). Nouns are like Lisp S-expressions, but
49simpler (Lisp atoms effectively have dynamic type bits).
51### `nock` (interpreter)
53Hoon compiles itself to the [Nock](nock) VM, a "functional assembly
54language" whose spec fits on a T-shirt. You don't need to know
55Nock to use Urbit, but it helps. Nock is an interpreter function
56that maps a pair `{data nock}` to a *product* noun, where `data`
57is the *subject* (input) and `nock` is the *formula* (program).
63[`mint`](mint) is the Hoon compiler. It maps a cell `{span twig}` to a
64cell `{span nock}`, where a `span` is a type, a `twig` is a compiled
65expression (AST), and a `nock` is a Nock formula. `mint` accepts
66a subject type and a source expression; it produces a product type
67and an executable formula.
69### `span` (type, as range)
71A [`span`](span) is a Hoon type. It defines a set (finite or
72infinite) of nouns and ascribes some semantics to it. There is
73no syntax for spans; they are always defined by inference (ie, by
74`mint`), usually using a constructor (`mold`).
75### `twig` (expression)
77A [`twig`](twig) is a Hoon AST node, the result of parsing a
78source expression. In general, a twig is a tagged union of the
79form `{stem bulb}`, where `stem` is a symbolic atom which
80controls the type of `bulb`. The regular form is a Hoon keyword
81`:stem` and a *rune*, or digraph keyword, made of two ASCII
82punctuation marks. The rune prefix character defines a twig
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list