Detailed contents
The contents opened out to the section level --- for going straight to a place.
Searches headings and index terms --- not the full text
Part I — Getting started
1.1Can you tell from the head alone?1.2Five ideas1.3One meaning, one spelling1.4Where the language stands1.5How to read this book
2.1Building the tool2.2hello, entropy2.3Running it two ways2.4How a contract stops execution2.5Getting rejected2.6--fmt fixes the shape2.7Arguments and capabilities2.8Common mistakes2.9This chapter’s syntax at a glance
3.1The name first, then the arguments3.2A free-standing full stop closes3.3A block is always do … end3.4Comments and literals3.5Names3.6Words are a budget3.7The boundaries of the expr island3.8Clause order in an op head3.9Common mistakes3.10This chapter’s syntax at a glance
Part II — Values and flow
4.1Integer types name their width4.2Widening is automatic, narrowing is written4.3Overflow stops4.4Division and remainder4.5Booleans are not numbers4.6Bitwise operations4.7Floating point4.8Common mistakes4.9This chapter’s syntax at a glance
5.1Two kinds5.2Purity is decided by observation5.3Don’t write effects on a fn5.4Effects spread to the caller5.5Parameters and return5.6Only neg is unary5.7Modifiers5.8Common mistakes5.9This chapter’s syntax at a glance
6.1The word says whether it changes6.2Write the type, or leave it to the value6.3No name without a value6.4How long a local lives6.5if yields no value6.6Common mistakes6.7This chapter’s syntax at a glance
7.1Conditions and loops7.2guard — turning a condition into a fact7.3Every path returns a value7.4match — every case, none missing7.5panic is an effect7.6Common mistakes7.7This chapter’s syntax at a glance
8.1Nothing to memorise in prefix notation8.2The island’s precedence table8.3What the island cannot do8.4Short-circuiting guards conditions8.5Expressions computed at translation time8.6Common mistakes8.7This chapter’s syntax at a glance
Part III — Data
9.1Start and length together9.2Writing needs mut slice9.3Narrowing the window9.4Contracts remove bounds checks9.5Common mistakes9.6This chapter’s syntax at a glance
10.1struct — a collection of named fields10.2enum — one of several10.3Variants are closed with full stops10.4Nothing may contain itself10.5Common mistakes10.6This chapter’s syntax at a glance
11.1option — a value, or none11.2result and the errors clause11.3try — passing failure upwards11.4Crossing between the two channels11.5Three ways to report failure11.6Combining and nesting patterns11.7Common mistakes11.8This chapter’s syntax at a glance
12.1Two kinds of borrow12.2Write permission only narrows12.3Many readers or one writer12.4A borrow cannot outlive what it borrows12.5There is no mut ref slice12.6Common mistakes12.7This chapter’s syntax at a glance
13.1type is an alias, newtype a new type13.2range — a contract that became the shape of a parameter13.3cast — where a value may change13.4bits — from 1 to 64 bits13.5Pinning down byte layout13.6Both directions of a layout, and a view that can fail13.7bitset — a set of small numbers13.8Scattered pieces as one view — segments13.9Three kinds of type words13.10Common mistakes13.11This chapter’s syntax at a glance
Part IV — Contracts and effects
14.1A contract is a checked promise14.2Whose fault is it?14.3Contracts remove checks14.4Conditions over every element14.5Naming a contract14.6Decide now what can be decided now14.7Contract grades14.8Build modes decide the remaining checks14.9Common mistakes14.10This chapter’s syntax at a glance
15.1Effects are closed words15.2Effects spread to the caller15.3Declared but not done is reported15.4The effects line is a set15.5via — a type argument decides the effects15.6What purity allows15.7Common mistakes15.8This chapter’s syntax at a glance
16.1Kinds of capability16.2Capabilities travel down the chain16.3Effects and capabilities are a pair16.4Kind, not presence16.5What the entry point receives16.6Common mistakes16.7This chapter’s syntax at a glance
17.1The boundary and the inside17.2How to split an error enum17.3Moving up the layers17.4Where information may be thrown away17.5Where panic is acceptable17.6Common mistakes17.7This chapter’s syntax at a glance
Part V — Memory
18.1Three places values live18.2Opening a region and obtaining space18.3Receiving a region18.4Nothing is carried out of a region18.5One cursor per root18.6The growing root18.7A stack on a region18.8Common mistakes18.9This chapter’s syntax at a glance
19.1owned and drop19.2Where branches meet19.3Release and completion19.4Not counting on the operating system to clean up19.5At what strength is memory safety guaranteed?19.6Common mistakes19.7This chapter’s syntax at a glance
20.1The three parts of an allocator20.2Cutting borrowed bytes20.3Swapping allocators20.4Default allocators that carve straight from a root20.5Growing and returning a piece — grow and release20.6Where the three layers sit in the standard library20.7Who sets the size of the fixed window?20.8Same bits, different reading20.9Common mistakes20.10This chapter’s syntax at a glance
Part VI — Abstraction
21.1One file, one module21.2Importing21.3What can be exported, and how to shorten a name21.4There is no search path21.5When names collide21.6Top-level order does not matter21.7Common mistakes21.8This chapter’s syntax at a glance
22.1Taking values and types at translation time22.2An instance per combination22.3Putting conditions on types22.4The type carries it, not a value22.5Common mistakes22.6This chapter’s syntax at a glance
23.1What they are for23.2Ops attached to types, and method23.3Traits with several ops23.4Signatures do not say fn or proc23.5When a trait is not satisfied23.6via self — more allocation effects only23.7Common mistakes23.8This chapter’s syntax at a glance
24.1The same work, two shapes24.2Stages and terminals24.3Walking once is the definition24.4Reading only as much as needed24.5The built-in map · filter with the same names24.6Common mistakes24.7This chapter’s syntax at a glance
Part VII — Concurrency
25.1Declare, make, talk25.2Carrying values in messages25.3Mailboxes — putting in and emptying25.4Let it crash, then restart25.5Where actors may be used25.6Actors that hold a capability, and what state may contain25.7Designing with actors — a transfer between two accounts25.8Common mistakes25.9This chapter’s syntax at a glance
26.1Flows are bound to blocks26.2Channels — containers with an order26.3Deadlocks you can see from what is written26.4Flows and memory26.5What does not exist yet26.6Common mistakes26.7This chapter’s syntax at a glance
27.1Declaring that a loop may be split27.2The three conditions the processor checks27.3The combining operation must be associative27.4Atomic operations27.5Memory orderings27.6Lanes — computing several values at once27.7Saying how a place is used — access27.8Common mistakes27.9This chapter’s syntax at a glance
Part VIII — The outside world
28.1Standard output28.2Reading a whole file28.3What is opened is closed28.4End and failure are different answers28.5Triggering failure on purpose28.6Common mistakes28.7This chapter’s syntax at a glance
29.1Calling C — mark, right, effects line29.2Types that cross the boundary29.3C calls Lowent29.4Callbacks and ownership29.5Common mistakes29.6This chapter’s syntax at a glance
30.1The register map30.2Access is enforced at translation30.3Interrupt handlers30.4What a machine supports — build tier30.5Machine instructions — asm30.6The absorbing boundary — where unsafe stops30.7Using what the machine has — --hw30.8Common mistakes30.9This chapter’s syntax at a glance
31.1The manifest and the project31.2Dependencies are pinned by hash31.3A different program per build — build option and config31.4Tests31.5How the compiler is verified31.6Asking where it is slow31.7Common mistakes31.8This chapter’s syntax at a glance
Part IX — The standard library
32.1Three layers — language, leaf, library32.2What gets in32.3The map by layer32.4File names and module names32.5Conventions every module follows32.6The list of leaf ops — what lies beneath the modules32.7Common mistakes32.8This chapter’s syntax at a glance
33.1Cut, find, assemble33.2UTF-8 — no replacement characters33.3Hex and base6433.4Hashes — three questions, three answers33.5Regular expressions — no backtracking33.6Common mistakes33.7This chapter’s syntax at a glance
34.1Sorting and finding u6434.2The type brings the criterion34.3A hash map over the caller’s slice34.4A growing generic vector34.5A ring buffer passing values between flows34.6Other containers34.7Common mistakes34.8This chapter’s syntax at a glance
35.1Generational handles35.2Brands — no mixing pools35.3Non-overlapping pieces — shard35.4Bit budgets — budget35.5Bit fields — wire35.6Other storage modules35.7Common mistakes35.8This chapter’s syntax at a glance
36.1Buffered output — forget to flush and translation refuses36.2Networking — handles are resources36.3Randomness — reproducible sequences and operating-system entropy36.4Time — monotonic clocks and wall clocks36.5The HTTP request parser — its heart is rejection36.6Cryptography — the order of the stack and the missing top36.7Common mistakes36.8This chapter’s syntax at a glance
37.1term does not write to the screen37.2Redrawing only changed cells37.3The number of cells is not the number of bytes37.4Reading keys is computation37.5Raw mode is a capability37.6What is not built yet37.7Common mistakes37.8This chapter’s syntax at a glance
Part X — Grounds: what has been proven
38.1Tests show existence, proofs show absence38.2Overlapping three layers38.3What is proven38.4Three ways of proving38.5Promises this part keeps
39.1Six tools39.2Sets and relations39.3Partial orders — incomparable pairs39.4Lattices and join — what to pick when combining39.5Monotone functions and fixed points — why analysis stops39.6Induction and invariants — dominoes39.7Abstract interpretation — ranges instead of values39.8Table of symbols39.9How the tools interlock
40.1Widening is a partial order40.2Division and remainder40.3Theorems that range provides40.4Putting stopping into the model honestly40.5What is not proven
41.1Computing with intervals41.2Relations — what intervals cannot do41.3Four stages41.4The row-major proof41.5Trust proofs, but back trust with checks41.6What is not proven
42.1Two machines and three events42.2The central theorem42.3Shapes rejected and shapes accepted42.4Finding an implementation defect while widening the model42.5Between model and implementation42.6What is not proven
43.1It breaks on the second round43.2At a fixed point, any number of times43.3Only one dangerous shape43.4Fresh tokens — one move that removes the naming problem43.5Nested loops — from function to relation43.6What is not proven
44.1Effects are sets of atoms44.2Four rules the processor enforces44.3Capabilities — the partner of effects44.4Effect soundness — not circular44.5Optimisations relying on effects are legitimate44.6What is not proven
45.1The Bernstein condition — an answer from 196645.2Independence means no races, and the condition is necessary45.3Between actors there is always a message45.4Containment — where heavy tools are needed45.5No races is not the same as deterministic45.6What is not proven
46.1Sequential consistency and its counterexample46.2An execution is a graph46.3Impossible with the default, possible with relaxed46.4Exactly that axiom forbids it46.5Message passing — the weak ones exist for this shape46.6Over all executions46.7Weaker orderings add behaviours46.8Seven tests from the literature46.9What is not proven
47.1The vocabulary of separation logic47.2There cannot be two tokens47.3Tools only as needed47.4rwlock — two proofs of the same sentence47.5Deadlock freedom and no starvation47.6A borrowed proof in weak memory — spsc47.7What is not proven
48.1Algebra and denotation48.2One statement is a one-statement block48.3Closers do the same job48.4Common mistakes48.5What is not proven
49.1Hash functions and Merkle DAGs49.2Called by content, not by name49.3What changes a hash and what does not49.4What can and cannot be proven49.5What hashes stop49.6What is not proven
50.1The trusted base — what proofs rely on50.2The largest gap — between model and implementation50.3What remains — by topic50.4Not sold as “fully statically safe”50.5So what may you trust