10 ms·
I dislike sum-type based error handling. It is annoying syntactically and only really doable with lots of high-level combinators, which in turn hinder debuggab
by clausecker 2y ago
I dislike sum-type based error handling. It is annoying syntactically and only really doable with lots of high-level combinators, which in turn hinder debuggability.
- lionkor 2y agoHave you tried the approach that Zig has, or the approach that Rust has? They are easy to debug and do not use any crazy stuff, just simple syntax like `try x()` (Zig) or `x()?` (Rust)
- clausecker 2y agoYes and that syntax sucks.
- lionkor 2y agoThat sounds like your opinion rather than a "it sucks because it encouraged bad practices" or something
- clausecker 2y agoif err != nil { return err; } is an antipattern. Codifying it through builtin constructs does not change this, but instead encourages such poor error handling. That's why try sucks.
- alper 2y agoI'm dealing with Rust based error handling now and nesting `match` statements is not exactly very happy. Or having to pull in `anyhow` and dealing with its awful awful documentation.