Learn

Walkthroughs

Three small programs, followed one decision at a time. Each shows what the compiler checks and why it is checkable from where you are reading.

The ideas page says what the pieces are. These pages show them working. Each one takes a real program from the repository and follows a single question through it.

The three walkthroughs

  • Follow a buffer reads a name from input and prints a greeting. The name's length is unknown until runtime, so someone has to own those bytes. You'll see a transfer, a lend, and a release in a dozen lines.
  • Who owns a graph that points back at itself? builds a cycle, walks it, then goes back to editing it. This is where brands and capabilities earn their keep.
  • What if the thread doesn't start? hands a buffer to a worker thread and looks at the one moment when ownership is genuinely ambiguous: when the OS says no.

More examples, by topic

The repository has a large set of example packages. The examples guide lists every one with how to run it. Some places to start:

Topic Read
Small programs and I/O hello, greet, wc
Linear values and memory linear, graph, arena_text
Traits and iteration traits, iter_combinators
Threads and low-level operations thread_sum, atomics, libuv_echo
Larger programs lisp, kvstore, json_check

examples/bad/ holds the opposite: programs the compiler must reject, each with the error it should produce. They're a good way to learn the rules, because every rule has a program that breaks it.