3 ms·
If Go ever adds exceptions[1] as an error handling mechanism, I'm out. Value errors are far superior to exceptions, even in their current state in Go. [1]: ass
by thiht 2y ago
If Go ever adds exceptions[1] as an error handling mechanism, I'm out. Value errors are far superior to exceptions, even in their current state in Go.
[1]: assuming panics are not an error handling mechanism but a recovery mechanism
- solumunus 2y agoMadness.
- jdbxhdd 2y agoPanics can be values and errors don't have to be values in go? I think you are missing up concepts here
- thiht 2y agoI’m not talking about the underlying model, I’m talking about the control flow. What I mean is errors are explicit values belonging to the signature of the functions.
- LinXitoW 2y agoChecked Exceptions are nothing but errors as values with some syntactic sugar for the most common use case (bubbling up the error). Gos version of value errors is just micrometers ahead of C style error codes. In both cases you get told "there could be an error", the error is a value of one single type (error/int), and you have to manually find out which different errors this value could represent. If you want to know what you're missing, check out Rusts error handling.
- thiht 2y agoI love Rust error handling and wish it would have been the default in Go (too late to shoehorn it), but it has nothing to do with exceptions.