📝Zig is betting on single compilation unit
Zig puts all source code into a single compilation unit and this underpins language semantics.
- Allows Zig to union all error types into a single
anyerror. - Having everything in a single compilation unit allows more optimizations.
- Allows Zig to infer upper bound stack size usage.
- It is going to power ziglang/zig#23367 Proposal: restricted function types, in turn enabling inferring stack upper bound in the presence of vtables.
- Ability to infer upper bound on stack usage will enable stackless coroutines.
- Error traces work by pre-allocating error trace array equal to max call depth before entering a function that may return error.
Backlinks
- 📝 Zig