No additional cognitive load on figuring out what's going on behind the scenes on errors. Priceless.
No additional cognitive load on figuring out what's going on behind the scenes on errors. Priceless.
It's all an incredible amount of effort to avoid what boils down to a basic nil pointer check. I agree the blocks are unsightly, but they're as plain and flat as you could possibly hope for. I almost think you'd be better off using syntax highlighting to obscure them if they're that painful to have to look at.
if err != nil {
return nil
}
becomes if err != nil: err <up arrow>Also it has a bit of educational component. It's like a seatbelt. In some societies people consider seatbealts annoying and irritating thing that restrict their freedom. They use seat belt plugs to get rid of that annoyance. Go just forces you to use it, regardless of your initial predisposition to the seatbelts.
Back then in C++ times, I also felt like 10+ min compilation times were non-issue. Until I experienced subsecond compilation times, of course.
Phrases like "noise created by error handling" start sound like "the incovenience created by seatbelt". It's not noise.