Comptime and Incremental Compilation

As far as I’m aware, there is no longer a way to do this. If you find one, please do say.

The issue you link is essentially solved, albeit with slightly different semantics. That issue proposes some stricter restrictions which we may or may not apply, but that’s not related to incremental compilation.

You seem to think the interactions between these features are unsolved problems. The relevant changes in the 0.12.0 release cycle have all but solved this problem. We have modeled incremental compilation in such a way that no more major language changes are probably necessary, with the possible exception of removing usingnamespace.

Even ignoring the aforementioned fact that no more big changes to comptime are necessary, I’d also like to note that Andrew has explicitly stated his willingness to change the language if necessary to make incremental compilation viable. To be blunt, if they’re necessary, these changes are going to happen.

Also, global comptime mutable state was always a bug. It worked in often unexpected ways, and made compiling Zig code non-deterministic. This “feature” is not coming back.

Why do you deem this a problem? Decidability is completely tangential to incremental compilation.

We do know what it is; we’ve done it. The incremental compilation model in the Zig compiler should work correctly under the current semantics.

As discussed above, we can and will change the language as needed to make incremental compilation work. From this perspective, nailing down the precise semantics before we’re sure of what works would be a ridiculous move.

Global comptime counters are not and will never be an intended feature of Zig. We are not going to design a language where the behavior of the program at compile-time is hugely implementation-defined (and in fact non-deterministic once we thread semantic analysis). This matter is entirely settled and has been for a long time.

5 Likes