Standard Library Overview
Everything lives under the global std object. The namespace is flat:
std.string, std.sort, std.math, and so on are direct members of std
(there is no std.algo or std.os nesting). All of it is restricted
(read-only) — scripts can call it but never modify it.
std.math.abs(-42)
std.string.upper("hi")
std.file.read("a.txt")
The std surface
| Module / function | Purpose |
|---|---|
std.string | String manipulation |
std.sort | Array algorithms (map, filter, sort, ...) |
std.seq | Sequence helpers (range, chunk, take, drop, sets) |
std.math | Math functions and constants |
std.convert | Number/string/base conversion, format |
std.hash | md5, sha256, crc32 |
std.crypto | AES encrypt/decrypt, file crypto, random bytes (OpenSSL) |
std.json | parse / stringify |
std.compression | zstd / lz4 compress & decompress (optional at build) |
std.image | PNG / JPEG / BMP load, save, convert |
std.uuid | uuid4() |
std.assert | assert, assert_eq, assert_ne, assert_throws |
std.file | File read/write, list, glob, temp, ... |
std.path | Path resolution and decomposition |
std.env | Environment variables, args |
std.time | Time, timers, calendars, unit conversion |
std.async | spawn, await, sleep, defer, race |
std.net | TCP / UDP / HTTP / WebSocket, DNS, URLs |
Some shortcuts are regular callable functions on std, not module objects
(see std.os).
Colon is never used to call module or member functions — use dot
(std.string.upper(...), ops.add(...)). Colon is only for pipes acting on a
value.
Module pages
Algorithm
- std.string — string manipulation
- std.sort — array algorithms
- std.seq — sequence helpers (range, chunk, sets)
- std.math — math functions and constants
- std.convert — number/base conversion
- std.hash —
md5/sha256/crc32 - std.crypto — AES and random bytes (OpenSSL)
- std.json —
parse/stringify - std.compression — zstd/lz4
- std.image — PNG/JPEG/BMP
System
- std.file — file read/write, list, glob, temp
- std.path — path resolution and decomposition
- std.env — environment variables,
args - std.time — time, timers, calendars
- std.uuid —
uuid4() - std.assert —
assert/assert_eq/assert_throws
Concurrency
- Overview — fibers, yield points, mental model
- Spawn & Await — futures and overlapping work
- Primitives: Sleep · Defer · Race
- Patterns — fan-out, parallel HTTP, keep-alive
- Errors —
awaitvslast_error()
Network
- TCP —
tcp_client/tcp_server - UDP —
udpdatagrams - HTTP Client —
http_client - HTTP Server —
http_server+ routes - WebSocket —
websocket - URL —
parse_url - DNS —
dns_lookup - HTTP Codes —
http_codesconstants - Overview: std.net