t, err := foo() if err != nil { return err } bar(t)
In languages with exceptions, this line just looks like
bar(foo())
This is why exceptions are an anti-pattern. They hide what functions can fail and what happens when they do.
In languages with exceptions, this line just looks like
And then you can't tell that foo might fail and we might not call bar. Even if you wrap the whole thing in a try/catch, it's not clear.This is why exceptions are an anti-pattern. They hide what functions can fail and what happens when they do.