Zith Language Specification

The formal specification for the Zith language, organised by topic. Each section defines the syntax, semantics, and constraints of a major language feature.

ℹ Note: The specification is also available as a single document in the GitHub repository.

Specification Sections

# Section Description
1 Overview & Design Philosophy Language goals, compilation pipeline, audience
2 Module System import, from, export, alias, use, visibility
3 Type System Primitives, structs, enums, unions, generics, when
4 Traits, Interfaces & Capabilities Nominal traits, structural interfaces, capabilities, operator overloading
5 Functions fn, const fn, async fn, flow fn, raw fn, return types
6 Mutability & Bindings let, var, global, const, deep mutability, destructuring
7 Memory Model (NRA) Ownership, lend/view/unique/share/belong, the four rules
8 Error Handling ?T, T!, with/catch, fail blocks, throw
9 Control Flow if, when, for, ->, flow fn, markers, docks
10 Concurrency & Threads spawn, await, #wont_remain, thread safety
11 Comptime const, reflection, type manipulation, intrinsics
12 Assets Compile-time asset processing, ZithProject.toml
13 Raw & Unsafe raw, unsafe, Trust capability
14 Polymorphism dyn, static vs dynamic dispatch, object safety
15 Macros Scoped, raw, tag macros, @ prefix
16 Words (Custom Operators) operator, token, precedence
17 Contexts DSL bundling, scoped activation
18 C Interop .h import, extern 'C', manual binding
19 Project Configuration ZithProject.toml, ZithFlags
20 Standard Library std, soon, c namespaces
21 Best Practices & Patterns Ownership patterns, naming conventions, Rule of Three

Related Documentation


Start here: Specification Overview