News for hackers. Stuff that matters.
Re:Zig in 30 Minutes by flohofwoe on Sunday January 03, 2021 @05:21AM (#25620895)
Yeah, I realized that after I hit send :)

For regular Zig source files, you just import them into other Zig source files, up to the "main file". Such imports are wrapped into a module struct (imported modules are just regular structs). The Zig build system takes care of efficiently compiling all this with proper incremental build support (one can explore the zig-cache subdirectory which is maintained by the zig compiler for details).

For example, these are the imports in a top-level file:

https://github.com/floooh/pacman.zig/blob/ed42fad79c3e9b4432...

The sokol.zig file groups other modules under a common namespace:

https://github.com/floooh/pacman.zig/blob/main/src/sokol/sok...

...which in turn imports "leaf modules" like this:

https://github.com/floooh/pacman.zig/blob/main/src/sokol/aud...

...it's one of the most straightforward module systems I've seen yet in any language.

There are no comments on this comment yet.