4 ms·
> You couldn’t do that in Go, for instance. You can – by making f accept g's return types, including the error. This is even being done in the Go standard libr
by EspressoGPT 3y ago
> You couldn’t do that in Go, for instance.
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 https://pkg.go.dev/text/template#Must
- rcme 3y agoThat’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.