Capabilities
Which high-level features a Program can use when it renders to Zig — low-level, allocation-explicit native code.
Contents
How a Program becomes Zig, in parts. Start with the introduction, then follow each part into the rendered output and the runtime it links against.
- Introduction — what the Zig target is, and how to read the rest of this section.
- Capabilities — which high-level features are possible, built in or through a library.
- Example — a full program using every keyword, and the Zig it renders to.
- Naming considerations — how Program's dotted names are carried into Zig.
- Entry point — starting a program from
mainwith its drivers. - Drivers — the native drivers that provide the interface, console and network.
- Runtime — the Reactive and Context machinery the rendered code links against.
- Native modules — the hand-written Zig behind
NATIVEfunctions. - Keywords — how each of Program's keywords renders to Zig.
- Project setup — the files and commands to build and run the rendered program.
- Reserved words — the words Zig keeps for itself, and how a colliding name is escaped.
What Zig is good for
Zig targets low-level, allocation-explicit native code — systems programming, embedded work, and small fast binaries. Like Go and Rust it has no native GUI, so the interface is a terminal; it gives fine control over memory and has a lean standard library. The reactive core and the drivers are the same as any target; only the driver set differs.
| Feature | Status | How |
|---|---|---|
| User interface | Terminal | The interface driver renders Ui to a terminal. No built-in windowed GUI; the browser is served by JavaScript. |
| Console | Built in | Console maps to std.debug.print / std.io. |
| Networking | Std library | Network uses std.net / std.http; the surface is smaller than other targets and still maturing. |
| Asynchrony | Built in | A LOCKED state models an in-flight value; a driver completes it and re-enters the cycle. Zig gives explicit control of the event loop. |
| Storage & files | Built in | Storage maps to std.fs. |
| Allocation | Explicit | Zig passes allocators explicitly; the runtime threads one through, which is why the entry point takes an allocator. |
| Animation / graphics | Not native | No rendering surface on the target; time-based effects are limited to a terminal. |
Where a capability needs host code it arrives as a NATIVE
Zig function (needing a zig body) or a driver — see
native modules and
drivers.