|
|
|
|
|
by qezz
107 days ago
|
|
In Zig you need an allocator to allocate anything, so whenever you need to add some extra information to an error, you pass a diagnostics object as an output argument to a potentially failing function. In this case it becomes a bit harder to compare it to Go's errors, each with pros and cons. I think comparing Go errors to Rust errors would be more fair. There are some articles about the diagnostic pattern in Zig, e.g. [1], [2] [1] https://github.com/ziglang/zig/issues/2647#issuecomment-5898... [2] https://mikemikeb.com/blog/zig_error_payloads/ |
|