Modules
- Files as structs. A Zig file is a struct: @import returns it, and its pub declarations are the API.
- @import. @import wires modules: std, dependencies and your files, one mechanism.
- Visibility. pub marks what leaves a file: everything else private by default.
Zig Build
- build.zig. The build system is Zig itself: build.zig scripting compilation as code.
- Build steps. Builds declare steps: executables, tests, options: a build graph, not a config file.
- Package manager. Dependencies pin by hash in the manifest: reproducible builds by construction.
Dependencies and Cross Compilation
- Cross targets. A target flag builds for any platform: musl Linux from Windows, ARM from x86.
- Vendoring C. Zig builds can compile C dependencies directly: one build graph, both languages.
- Small dependency culture. Zig culture keeps dependencies few: the standard library first, always.
Before and after this level
- Before: Level 6: Comptime: Compile-Time Evaluation, Generic Programming, Compile-Time Code Generation.
- Next: Level 8: C Interoperability: Calling C, Exporting Zig, Replacing or Extending C Components.
In the app each of these ideas is taught and then asked back, and the level ends with a checkpoint and flashcards. See Checkpoints and flashcards.
Frequently asked questions
What does Zig Level 7: Modules & Build System cover?
Modules, Zig Build, Dependencies and Cross Compilation: 3 lessons and 9 ideas.
What should I know before this level?
The level before it, Level 6: Comptime, which covers Compile-Time Evaluation, Generic Programming, Compile-Time Code Generation.