Re:Go proposal: Leave “if err != nil” alone?
by spullara on Friday June 28, 2019 @02:45PM
(#20307592)
You just replace err with _ and it doesn't care anymore:
Re:Go proposal: Leave “if err != nil” alone?
by stcredzero on Friday June 28, 2019 @02:32PM
(#20307433)
Is there a way in Haskell to have Maybe with an optional callback?
https://play.golang.org/p/3ujNLwOdXZf
But explicitly having to handle them versus implicit exception based handling is a tradeoff. Often it isn't clear which exceptions a function might throw unless you've read all the documentation or you're the one who wrote it. When I'm coding my own stuff I'd tend to prefer exceptions but in larger teams I'd tend to prefer explicit handling.
And then there are languages, e.g. Haskell and its Maybe, that manage to combine the best of both worlds.