Documentation

· hunky dory

Learn the language one concept at a time. You do not need to read the specification first.

How to read this

The specification defines the language rules. It is short enough to fit in a prompt, the text you give a model. These fourteen chapters explain the language in order, one concept at a time. Consult the specification on this site when you need a precise rule.

whatread it when
The home page, and the repository’s READMEyou want to know what this is and whether to look further
This guide, fourteen chaptersyou want to learn the language one idea at a time, with programs that run
The specification, one fileyou need the exact rule, or something did not compile and you want the sentence that refused it
Why, the refusals, the common questions and what is measuredyou want to know why a rule is there, what was turned down, and which claims have a number behind them
The design document and the sittings, in the repositoryyou want the reasoning behind a decision, and who took it

Every code example comes from a file in examples/. Its filename appears below the block. During the build, the process that generates the site, a check compares each block with its source and stops the build if they differ. On every commit, a change saved in the repository history, these programs are compiled and run in three configurations. Browse the examples and their output →

The chapters

Read the chapters from top to bottom: each uses concepts explained in the preceding ones. Beside each title you will find the program used for its examples.

  1. A first program files, layout, comments as documentation · examples/gallery/00-first.hero
  2. Errors read a compiler message, apply its fix, and see what it does not catch · tests/golden/
  3. Records and functions declarations, named fields, calls with a dot · examples/gallery/01-points.hero
  4. Variants and match handle every case explicitly · examples/gallery/02-tokens.hero
  5. Failure is a value no null, no exceptions · examples/gallery/03-fallible.hero
  6. Control flow if, while, for, range · examples/gallery/04-loops.hero
  7. Bindings and mutation = and @, and why shadowing is an error · examples/gallery/05-mutation.hero
  8. Generics and function values one shape, many types · examples/gallery/06-generics.hero
  9. Strings special characters, bytes and text, and a value inside a string · examples/gallery/07-strings.hero, 12-interpolation.hero
  10. Maps lookup returns a value or an error · examples/gallery/10-maps.hero
  11. Values all the way down copies, and a tree with no pointer in it · examples/gallery/11-trees.hero
  12. Modules and files how to find a module and use its name · examples/shapes/
  13. Tests and holes tests in the language, and ??? as a question · examples/gallery/09-holes.hero
  14. The C boundary extern, headers, and what clang checks for you · examples/gallery/08-ffi.hero