Standard Library
Everything available to a Zinc program: global builtins, the auto-loaded prelude, native modules (implemented in Odin), and .zn library modules (plain Zinc source).
This document describes everything available to a Zinc program without writing your own code: the global builtins (always present), the auto-loaded prelude (println, printf, …), the native modules (implemented in Odin, imported by name), and the .zn library modules (written in Zinc, imported by name).
- Builtins and the prelude need no
import— they are global. - Everything else is imported by name:
import "strings",import "algo", etc. - Native modules are compiled into the interpreter.
.znmodules are plain Zinc source you can read and edit — and are **also embedded directly in the interpreter binary** at compile time, so a barezinc.exeneeds no$ZINC_PATHand no on-diskstdlib/directory to import any of them.$ZINC_PATH(or an exe-adjacentstdlib/dir) is only an override: point it at an on-disk copy of the stdlib source when you want to edit a.znmodule and have your changes picked up without recompiling the interpreter.
Conventions used throughout
Error convention. Fallible library functions follow one rule (see docs/stdlib-audit-2026-07-19.md):
- A value-returning fallible function returns
(value, err), whereerrisnilon success or a message string on failure. Bind both:text, err := fs.read("f.txt"). - A void action returns the
errslot alone:err := fs.write(p, s). - A pure predicate returns a bare
bool:if fs.exists(p) { … }.
The signature notation => (string, string?) means "returns a string and an optional error"; => string? means "returns an optional error alone"; => bool is a predicate that cannot fail.
Signatures are written in Zinc syntax. ..any is variadic. T? is T | nil (optional). [T] is a list of T; [K, V] is a map from K to V.
Reference
builtins | Always-available global functions — 15 functions, no import. |
prelude | Auto-loaded print/format wrappers — 11 functions, no import. |
Native modules
Compiled into the interpreter. Import by name.
os native | Process, environment, and subprocess access. (8 functions) |
fs native | Filesystem I/O. (13 functions) |
path native | Pure path-string manipulation (no I/O). (5 functions) |
time native | Clocks, sleeping, and RFC-3339 formatting. (8 functions) |
math native | Numeric functions and constants. (22 functions) |
strings native | String operations. (15 functions) |
conv native | Parsing and value conversion. (9 functions) |
json native | JSON parse/serialize. (2 functions) |
regex native | A small backtracking engine (no PCRE). (5 functions) |
encoding native | Byte-oriented text encodings over a string's raw UTF-8 bytes. (6 functions) |
random native | Seedable non-cryptographic PRNG. (9 functions) |
crypto native | Hash digests + a CSPRNG. (7 functions) |
csv native | RFC-4180 CSV. (2 functions) |
net native | Offline URL toolkit only — not a network client. (3 functions) |
.zn library modules
Written in Zinc under stdlib/. Import by name; read and edit the source directly.
algo .zn | Functional collection utilities. (29 functions) |
strings_ext .zn | Higher-level string helpers over the native strings module. (12 functions) |
math_ext .zn | Integer math, number theory, and statistics over the native math module. (21 functions) |
io .zn | Higher-level file/stream helpers over fs. (9 functions) |
log .zn | Structured, leveled logging to stderr. (7 functions) |
set .zn | Set operations backed by [string, bool] maps (keys are strings; use string(v) to hash arbitrary values). (13 functions) |
queue .zn | FIFO Queue and LIFO Stack, thin wrappers over lists. (10 functions) |
result .zn | First-class Result and Option wrappers, for passing errors as values instead of using multi-return. (14 functions) |
strbuilder .zn | O(n) string assembly (vs. (6 functions) |
async .zn | Cooperative, single-threaded task scheduler (the run-to-completion core of the concurrency model). (3 functions) |
testing .zn | Minimal test framework. (7 functions) |