7# Concepts and terminology
9Usually, a new language is an improvement on one you already
10know. If it isn't, it probably at least shares concepts with a
11large family of relatives. These concepts come with words, like
12*type* or *function*, that map cleanly onto its semantics.
14In Hoon we throw away almost all these words and invent new
15ones, which mean almost the same things. But wait, wat?
19Hoon has no close relatives, and the normal jargon of programming
20maps poorly onto its semantics. For example, although Hoon is a
21typed language, the term *type* is not formally defined in Hoon.
22It's a great word, but Hoon has three quite separate concepts
23which could comfortably claim it. We say *type* all the time;
24we mean `span`, or `mold`, or `mark`, or possibly all three.
25Sometimes this is ok and sometimes it isn't.
27Other common programming concepts used only informally in Hoon
28are "function," "object," "event," "expression," "variable,"
29"label," "closure", "environment," "stack," and probably a few
30more. We can get away with any of these conventional words --
31and we do. But when we do, we're making an analogy that relies
32on context for precision.
36Any `word` in code font is a `limb` (label) in the Hoon kernel.
37Any jargon that isn't a limb is in *italics*.
41Top-level Hoon concepts: `noun` (data), `nock` (interpreter),
42`mint` (compiler), `span` (type), `twig` (expression).
48A value in Hoon is called a [`noun`](noun). A noun is either a
49unsigned integer of any size (`atom`), or an ordered pair of any
50two nouns (`cell`). Nouns are like Lisp S-expressions, but
51simpler (Lisp atoms effectively have dynamic type bits).
53### `nock` (interpreter)
55Hoon compiles itself to the [Nock](nock) VM, a "functional assembly
56language" whose spec fits on a T-shirt. You don't need to know
57Nock to use Urbit, but it helps. Nock is an interpreter function
58that maps a pair `{data nock}` to a *product* noun, where `data`
59is the *subject* (input) and `nock` is the *formula* (program).
65[`mint`](mint) is the Hoon compiler. It maps a cell `{span twig}` to a
66cell `{span nock}`, where a `span` is a type, a `twig` is a compiled
67expression (AST), and a `nock` is a Nock formula. `mint` accepts
68a subject type and a source expression; it produces a product type
69and an executable formula.
71### `span` (type, as range)
73A [`span`](span) is a Hoon type. It defines a set (finite or
74infinite) of nouns and ascribes some semantics to it. There is
75no syntax for spans; they are always defined by inference (ie, by
76`mint`), usually using a constructor (`mold`).
77### `twig` (expression)
79A [`twig`](twig) is a Hoon AST node, the result of parsing a
80source expression. In general, a twig is a tagged union of the
81form `{stem bulb}`, where `stem` is a symbolic atom which
82controls the type of `bulb`. The regular form is a Hoon keyword
83`:stem` and a *rune*, or digraph keyword, made of two ASCII
84punctuation 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