Compilation of mutually-exclusive namespaces within a single source file

Lazy evaluation is basically a certainty at this point. I made a post about that today, actually: Comptime segfault on recursive types - #3 by AndrewCodeDev

The reason that compiler error in the example I linked to doesn’t actually fire is because that branch is never taken and gets thrown out. If you make it depend on runtime data, all branches get inspected and the compiler error fires. So not only does this happen at the level you’re talking about, it happens automatically even on switch/if-else branches.

For more info, I’d recommend looking into std.refAllDecls. It looks like they won’t keep that utility in the standard forever, but it’s what the utility does that may help clarify the behaviour you’re talking about. (for reference about why I said it may not stick around, check out: `std.testing.refAllDecls` references `pub` decls only, private ones are ignored · Issue #12838 · ziglang/zig · GitHub)

1 Like