▲ | XorNot 3 days ago | |||||||
I mean broadly that's my entire problem with errors as values: every implementation wastes a ton of syntax trying to make them like exceptions. | ||||||||
▲ | MindSpunk 3 days ago | parent | next [-] | |||||||
The common problems with exceptions isn’t the easy part of try/catch, it’s the execution model and “any function could throw” that causes most contention. Error values are logically simpler and fully document if and what errors the function can return. Checked exceptions solve that too, but in practice nobody used them even where available. And you still end up with hidden control flow with exceptions, the exceptional path through a function is syntactically invisible and difficult to audit without very strong language tooling. | ||||||||
| ||||||||
▲ | b_e_n_t_o_n 3 days ago | parent | prev [-] | |||||||
Go unironically gets this right - you just treat them like a normal value instead of trying to make them more "ergonomic". |