Is this not widely considered to be the ugliest part of the language? Why do you prefer having to do this manually?
Common in ML-family languages and Rust. They've been brought into most mainstream languages like Java by now because of how useful they are.
I'm considering glojure as an interesting new hobby language to try because it's benchmarks are impressive
If the go compiler ends up bloating itself with checks its static analyser could/should have done it would be a shame
Where Maybe is a polymorphic union of T and nil but the core library returns either (T, bool) or (T, E) where E is an error enum.
These days async/await is first-class and the function-based callback form of promises is largely discouraged. And for, at least in part, the same reason: it's harder to enforce correctness.
[1]: https://odin-lang.org/docs/overview/#or_return-operator
T someFn() throws E;
fn someFn() -> Result<T, E>;
func someFn() (T, E)I believe some exceptional languages are similar, like Ruby. If you rescue but dont abort, the variable on the left hand side gets a nil when that may otherwise not be possible. Of course, that is handled cleanly as its own error.