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