3 ms·
I've never gotten the explicit argument. Java checked exceptions are also part of the function signature/interface and nothing prevents one from making a langu
by hughesjj 3y ago
I've never gotten the explicit argument. Java checked exceptions are also part of the function signature/interface and nothing prevents one from making a language where all exceptions are checked then just doing
try {
maybeError := FunctionThrowingValueError()
} catch (ValueError e) {
// do stuff
}
I get at the end of the day it's all semantics, but personally I kinda like the error-specific syntax. If you want to do the normal return path, that's fine, but I prefer the semantics of Rust's Result type (EITHER a result OR an error may be set).
To each their own, it's not something I really worry about.
- freedomben 2y agoYeah same, Go's explicit argument never resonated with me either. In Elixir it's similar to a Result type, being a tuple such as either `{:ok, return_val}` or `{:err, err_msg}`, which is perfect for using with `case` or `with` depending on your situation.