Comment by rienbdj

5 hours ago

Question for Zig users:

Can comptime blow up compile times? Does it have arbitrary cutoffs like C++ template depth?

You can think of comptime (as of zig 0.16) as an interpreter that evaluates code with very limited optimization. So yes, naive use of comptime can definitely grind compilation to a halt.

Zig tackles the halting problem a bit differently by putting the evaluation cutoff in userspace through the compiler builtin function `@setEvalBranchQuota`. You bump up the quota as you see fit.