4 ms·
> There is no better way. Zig's way is better. Error returning is explicit, error returning is declared in the function signature. Error returning plays nice
by throwawaymaths 2y ago
> There is no better way.
Zig's way is better.
Error returning is explicit, error returning is declared in the function signature. Error returning plays nice with defer (there is errdefer) and there is limited sugar (try keyword) that makes life easier.
- ngrilly 2y agoAgreed. Zig has all the advantages of Go's explicit errors as values without the drawbacks.
- ncruces 2y agoI meant in Go. This is not a pissing match. I personally like it better than exceptions (even if it's much noisier for the 95% common case as another poster put it), both of which I've used enough to appreciate the pros/cons of. But that's about it. I'll probably never use Zig enough to find out.