Recently I’m implementing a indoor cycling workout, using zon for the workout program.
I tried do parse a zon document, but I used zon.parse.fromSlice instead of zon.parse.fromSlice, getting an user unfriendly error:
install
└─ install workout
└─ compile exe workout Debug native 1 errors
/home/manlio/.local/share/sdk/zig/0.16.0/lib/std/debug.zig:420:14: error: reached unreachable code
if (!ok) unreachable; // assertion failure
^~~~~~~~~~~
/home/manlio/.local/share/sdk/zig/0.16.0/lib/std/zon/parse.zig:270:20: note: called at comptime here
comptime assert(!requiresAllocator(T));
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
I think that using assert in this case is incorrect.
Why not using @compileLog? In this case it is possible to report a friendly message.
The second problem is more problematic.
I found that if the workout schema has too many fields, during build I got:
install
└─ install workout
└─ compile exe workout Debug native 1 errors
/home/manlio/.local/share/sdk/zig/0.16.0/lib/std/zon/parse.zig:874:16: error: evaluation exceeded 1000 backwards branches
inline for (field_found, 0..) |found, i| {
~~~~~~~^~~
/home/manlio/.local/share/sdk/zig/0.16.0/lib/std/zon/parse.zig:874:16: note: use @setEvalBranchQuota() to raise the branch limit from 1000
This is problematic, because the user can not change the branch quota.
Thanks