The Glide Book
A complete guide to Glide.
From glide run hello.glide to a multi-package service. Each chapter compiles to real working code, nothing is hand-waved. Written and maintained by Murillo Deolino.
- 33
- Chapters
- ~568
- Minutes
- 0.3.3
- Glide
Foundations
Install the toolchain, learn the shape of the language, and write your first programs.
Getting started
From zero to running your first Glide program. Install the toolchain, learn what `glide run` does under the hood, and meet the four commands you'll use every day.
- Install
- Your first program
- A real project
- The four commands you'll use every day
Types and bindings
Glide's static type system: integers by width, floats, bool, strings, the let/mut/const trio, and a first look at structs, vectors, and hashmaps.
- Bindings: let, mut, const
- Integers, spelled by width
- Floats
- Booleans
Functions and control flow
Define functions with typed parameters, branch with if and match, loop with for and while, and learn the quiet superpower: most things in Glide are expressions, including blocks.
- Functions
- if is an expression
- match
- Loops
Errors & memory
How Glide handles failure and ownership — no exceptions, no lifetime annotations.
Errors as values
Glide has no exceptions. Failures live in return types: !T for "T or an error", ?T for "T or nothing". The ? operator turns five lines of error handling into one.
- The two failure-shaped types
- Reading the value out
- The ? operator
- The ?? operator: defaults
Memory model
How Glide frees memory without a garbage collector and without lifetime annotations. Ownership, borrows, auto-drop — explained from scratch.
- What lives where
- Two kinds of heap pointer
- Auto-drop: cleanup you don't write
- Returning a heap value: use a raw pointer
Types & traits
Modelling data with structs, enums, generics, and the trait system.
Concurrency
M:N coroutines, channels, and select — the parallelism story.
Project
Modules, packages, the manifest, and shipping a real application.
Standard library
A tour, then a chapter per module — strings, collections, math, time, files, JSON, regex, networking, and more.
A tour of the standard library
A guided tour of the batteries Glide ships with: strings and vectors (built in), then hashmaps, iterators, math, time, files, environment, and JSON from `stdlib::*`. The functions you'll actually call.
- Strings
- Vectors
- HashMaps
- Math
Prelude & built-ins
The always-in-scope prelude — printing, formatting, raw heap allocation, channels, CLI args, scheduler helpers, diagnostic macros, memory introspection, and the Pair<K,V> type.
- Import
- Public surface at a glance
- Printing & formatting
- Channels
Strings
Reference for Glide's built-in string type: inspection, search, slicing, splitting, transformation, and parsing methods.
- Import
- Method catalog
- Inspection & comparison
- Searching
Vector\<T>
Vector<T> API reference — growable owning array: construction, mutation, functional combinators, iterators, and element-typed reducers for i32/f64/string/bool.
- Import
- The struct
- Construction
- Element access & mutation
HashMap & Set
Reference for Glide's string-keyed HashMap<V> and string StringSet collections: insert, get, remove, iteration snapshots (keys/values/entries), map_values, and lifetime management.
- Import
- HashMap&lt;V&gt;
- StringSet
- Pair&lt;K, V&gt;
Iterators
The stdlib::iter module — the Iterator trait, VecIter, and eager combinator helpers (map/filter/take/skip/fold/find/range/repeat) over Vector<T>.
- Import
- Public surface at a glance
- The Iterator trait
- Transformers — return a new *Vector<U>
Math
Glide standard library math reference: libm float functions (sqrt, pow, trig, logs), the PI/E constants, and pure-Glide integer/float helpers (min/max/clamp, abs, sign, ipow, gcd, lcm).
- Import
- Surface at a glance
- Constants
- Floating-point functions
Time
Standard-library time API — Duration spans, Time instants with civil components and formatting, the monotonic Stopwatch, RFC 3339 parsing, and the after/tick timer channels.
- Import
- Constants
- Duration
- Time
Filesystem & I/O
Standard-library reference for stdlib::fs (files, directories, paths, binary I/O) and stdlib::io (stdin/stdout/stderr line and byte I/O).
- Import
- Reading files
- Writing files
- Existence, size & type
OS
Host machine and process identity — platform detection, process IDs, cwd, executable path, hardware info, standard directories, TTY checks, and a one-liner shell escape.
- Import
- Full catalog
- Platform identity (compile-time, infallible)
- Process identity
Environment & CLI args
Per-process environment for Glide programs: CLI argument access, environment-variable lookup/mutation/enumeration, variable expansion, and process exit.
- Import
- Public surface at a glance
- CLI arguments
- Reading environment variables
Process
Spawn and run subprocesses with argv-level control — capture stdout/stderr, set env and cwd, feed stdin, stream live pipes, and inspect exit codes and signals.
- Import
- Overview
- Result and configuration types
- Building a command
JSON
JSON parsing, emitting, and the JsonValue tree — constructors, navigation, typed accessors, building, and the JsonBind trait.
- Import
- Public surface at a glance
- Kind constants
- The JsonValue struct
Regex
stdlib::regex — a pure-Glide PCRE-like regular-expression engine: compile patterns, match/search/find/replace/split, captures (numbered and named), and the supported syntax (classes, quantifiers, anchors, backreferences, lookaround, flags).
- Import
- At a glance
- Compiling patterns
- Testing for a match
Random
Pseudo-random number generation in Glide's standard library: the xorshift64* Rng generator, deterministic and clock seeding, and helpers for raw 64-bit values, non-negative ints, bounded ranges, uniform floats, and coin flips.
- Import
- Public surface at a glance
- The Rng generator
- Construction
Encoding, crypto & compression
API reference for Glide's encoding, crypto and compression modules — base64, hex, ByteBuffer, SHA/HMAC hashes, gzip inflate and in-memory tar extraction.
- Import
- Public surface at a glance
- base64
- hex
Logging
stdlib::log — structured leveled logger: log levels, info!/warn!/error! macros, the Logger/LoggerBuilder/LogSink/LogLine types, structured fields, output formats and sink configuration.
- Import
- Public surface at a glance
- Levels, formats, timestamps, and sink kinds
- Quick start: the global logger
Synchronization
Synchronization primitives — Mutex<T>, Atomic, and WaitGroup for guarding shared state across coroutines.
- Import
- Overview
- Mutex&lt;T&gt;
- Atomic
CLI: argparse & spinner
CLI building blocks — the ArgParser flag parser (string/int/bool flags, short+long forms, positionals, auto --help) and the stderr progress spinner.
- Import
- Public surface at a glance
- argparse — overview
- Flag value structs
Networking, HTTP & URL
The full Glide networking stack — IPv4/IPv6 addressing and SocketAddr parsing, DNS resolution, TCP client and server, UDP with IPv4 multicast, raw sockets and ICMP ping/traceroute, TLS 1.2/1.3 over OpenSSL, WebSocket client, a complete HTTP/1.1 client (cookies, forms, multipart, JWT, gzip), an HTTP/1.1 server with method routing, typed extractors, middleware chains, CORS, static files, SSE and a reverse proxy, plus HTTP/2 and HTTP/3 clients and URL percent-encoding.
- Import
- Module map
- IP & socket addresses — IpAddr
- DNS resolution — resolve
Email (SMTP / IMAP / POP3)
Compose, send, and read email from Glide — build RFC 5322 messages with the Mail type, send over SMTP (STARTTLS / SMTPS, PLAIN / LOGIN auth), and read mailboxes over IMAP4rev1 or POP3.
- Import
- The Mail type
- SMTP — sending
- IMAP — reading & flagging
System & tooling
System & tooling reference — typed OS signal handling, runtime stack-trace capture, the compile-time meta (AST) surface for proc-macro authors, and the built-in lint codes plus the lint_code helper.
- Import
- Signals
- Backtraces
- Declarative macros (macro name!)
Building applications
Put it together: an HTTP service, then tests and benchmarks to keep it honest.
Building HTTP services
A complete guide to HTTP in Glide's stdlib::http: the coroutine-per-connection server (plus HTTPS and worker pools), the request/response types and builder, method-aware routing, middleware, the attribute DSL and typed handlers, the full extractor catalog, JSON binding, streaming and SSE, static files and uploads, the HTTP client, and the lower-level HTTP/2, HTTP/3, JWT, and reverse-proxy building blocks — ending in a runnable CRUD API.
- Hello, server
- Serving: http_listen, HTTPS, and workers
- Requests and responses
- Routing with Router
Testing and benchmarks
Prove your code works and measure how fast it runs. Writing *_test.glide files, the assertion macros, glide test, golden tests for whole programs, and microbenchmarks with glide bench.
- Your first test
- The assertion macros
- Running the suite
- The three layers
Going lower
Reach below the language — call C, embed raw C, and write inline assembly.