Hacker News new | ask | show | jobs
by rienbdj 55 days ago
Question for Zig users:

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

1 comments

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.