`@setEvalBranchQuota` does not behave as expected
Zig Version
0.12.0-dev.3437+af0668d6c
Steps to Reproduce and Observed Behavior
@setEvalBranchQuota(2000);
@setEvalbranchQuota(1000);
Expected Behavior
In the above example, the resultant quota is 2000, which is counterintuitive given the name of the builtin.
The docs for @setEvalBranchQuota state:
Increase the maximum number of backwards branches that compile-time code execution can use before giving up and making a compile error.
If the new_quota is smaller than the default quota (1000) or a previously explicitly set quota, it is ignored.
The naming suggests that the eval quota is set to the last called value. This causes confusion when perusing source code (ie std.ComptimeStringMapWithEql) which sets the value to some n. It's not clear that setting it higher before this call will be of any use.
Perhaps a name like @increaseEvalBranchQuotaTo(n) would be more clear as to what the builtin actually does.
Running into https://github.com/ziglang/zig/issues/19803 again. @setEvalBranchQuota should be replaced with @increaseEvalBranchQuotaBy.
Then,
@increaseEvalBranchQuotaBy(2000);
@increaseEvalBranchQuotaBy(1000);
// eval branch quota now default + 2000 + 1000
No, increasing the quota by an amount rather than setting the max upper bound will lead to infinite compilation loops.
Rejecting the proposal to rename the builtin to "increaseEvalBranchQuotaTo" because I think it is not any clearer.