Learn Coil, then look things up.
Two halves: a tutorial that builds the language up one chapter at a time, and a reference to come back to for exact rules and APIs.
The tutorial
Start from installation and a first program, then work through 16 chapters — types, collections, classes, errors, traits, modules, IO, testing, tasks, threads, macros and C.
Start with Getting started → ReferenceThe reference
802 pages of precise lookup: a page for every module, type and function, plus grammar, the type system, operators, keywords and error codes.
Open the reference index → PackagesThe ecosystem
Docs for spool, coil-stdlib and every library — JSON, TOML, HTTP, TLS and more — in the same place as the language.
Browse packages →A guided path, in order
Each chapter builds on the one before. Read them in sequence the first time.
Overview
The language at a glance and where to start.
Install & first runGetting started
Install coil and spool, run a first program, start a project.
- 01 Basics Printing, variables, functions,
ifand loops. - 02 Types & variables Built-in types, inference,
as, strings, tuples, records, constants. - 03 Collections Arrays,
Vec, maps and sets; sorting, mapping, filtering. - 04 Classes Fields, methods,
pub, static functions,derive, generic classes. - 05 Enums & match Cases with data,
match,Option,if let. - 06 Error handling
Result,raise,?,??andpanic. - 07 Traits & generics Generic functions, bounds, your own traits, trait-typed values.
- 08 Functions as values Lambdas,
use (…)captures, returning functions, partial application. - 09 Modules & packages Files as modules,
use, and packages with spool. - 10 Files & IO The terminal, files, directories, arguments and permissions.
- 11 Testing
testblocks,assert!, doc examples and contracts. - 12 Generators
gen fn,yield, lazy sequences and pipelines. - 13 Tasks Concurrent IO on one thread: scopes, channels, timeouts.
- 14 Threads Parallel CPU work:
spawn,join, channels, mutexes. - 15 Macros
name!(…),#[attr(…)]and#[derive(…)]: code that writes code. - 16 Calling C
externblocks,dloadand the flags that allow a library.
Look it up
Organised by what you are looking for — not the order you learn it.
Language
Grammar, type system and the rules the compiler enforces.
Prelude & primitives
In scope in every file, no `use` needed.
Compiler modules
Shipped with the compiler; import what you use.
Standard library
coil-stdlib: collections, text, numbers, blocking IO.
Package docs
Synced from each package's repository, alongside the manifest and lockfile reference for spool.
spool
The package manager: commands, manifest and lockfile.
coil-stdlib
The userland standard library.
json
JSON and JSONC.
toml
TOML 1.0.
msgpack
MessagePack.
http
HTTP client and server.
tls
TLS streams on rustls.
crypto
Hashing and secure randomness.
regex
PCRE2 regular expressions.
deflate
DEFLATE compression.
time
Calendar and monotonic time.
greet (example)
A minimal package consumed via spool.
Read real code
Examples catalog →
Every runnable demo in the repository, with expected output.
Showcase projects ↗
A todo board, a text adventure and a TCP echo server, with tests.
coil-stdlib →
The userland standard library: collections, text, bytes, IO adapters.
Internals ↗
Pipeline, opcodes, debug info and the grammar — for contributors.