Reference
This is the reference for the Zena language, its standard library, and its toolchain. It aims to be precise about what the language does today, rather than what it is planned to do.
If you're new to Zena, start with the guide instead — it introduces the same material in reading order.
How to read this reference ​
Each page covers one construct and follows the same shape: syntax, semantics, examples, and how the construct is represented in WebAssembly. The Wasm sections are there because Zena's design is inseparable from its target; if you only want to write code, they're safe to skip.
Pages are grouped by what they describe:
- Core language — libraries, variables, functions, expressions, operators, comments
- Data types — numbers, booleans, strings, records, tuples, arrays, maps, sets, ranges, enums
- Types — the sound type system, inference, aliases, distinct types, unions, generics, and narrowing
- Control flow — conditionals, loops, pattern matching, destructuring, exceptions, and cancellation
- Classes — the nominal type system, interfaces, mixins, and sealed hierarchies
- Standard library — one page per
zena:library - Toolchain — the CLI, targets, flags, formatter, and language server
Conventions ​
Code samples are complete unless they end in // .... Where a sample shows an
error or warning, it appears with an inline diagnostic and squiggly underline:
let n: i32 = 42;
let x: f64 = n;
Error:
Grammar snippets use a light EBNF: ? for optional, * for zero or more, |
for alternatives, and '…' for literal tokens.
Feature status ​
Zena is under active development. Pages carry a badge when the feature they describe isn't fully implemented:
- Stable implemented and unlikely to change
- In progress partly implemented; details may change
- Planned designed, not yet implemented
Where a page has no badge, treat the behaviour as implemented but the surface as still open to change — nothing in Zena is frozen yet.
Quick links ​
- Comments — comments and documentation syntax
- Libraries — source files, entry points, imports, and packages
- Type system overview — how the type system fits together
- Numbers — integers, floats, and numeric semantics
- Strings — string literals, template interpolation, and encodings
- Pattern matching —
match, patterns, exhaustiveness - Classes — nominal classes and object orientation
- Standard library — what ships with Zena
- CLI — every command and flag