2 ms·
The way Zig addresses it also discards all of the runtime variability too. In Go, an error can say something like unmarshaling struct type Foo: in field Ba
by kbolino 1y ago
The way Zig addresses it also discards all of the runtime variability too. In Go, an error can say something like
unmarshaling struct type Foo: in field Bar int: failed to parse value "abc" as integer
Whereas in Zig, an error can only say something that's known at compile time, like IntParse, and you will have to use another mechanism (e.g. logging) to actually trace the error.
- metaltyphoon 1y agoYep. Errors carry no context whatsoever and you have no idea where they came from.
- Zambyte 1y agoYou can trace error returns with the builtin @errorReturnTrace function. https://ziglang.org/documentation/0.14.1/#errorReturnTrace https://ziglang.org/documentation/0.14.1/#errorReturnTrace https://ziglang.org/documentation/0.14.1/#Error-Return-Traces https://ziglang.org/documentation/0.14.1/#Error-Return-Trace...
- gf000 1y agoI mean, this is definitely not a strong suit of go either. In Zig you can just pass in a pointer though to add additional context.