Re:Unchecked Java: Say Goodbye to Checked Exceptions Forever
by rcme on Friday July 14, 2023 @08:48AM
(#36723181)
That’s interesting, but consider two functions like func ParseInt(string) (int, error) and func Abs(int) int. You lose some composability when using errors over exceptions. The Rust solution mentioned elsewhere seems elegant.
You can – by making f accept g's return types, including the error. This is even being done in the Go standard library: https://pkg.go.dev/text/template#Must