News for hackers. Stuff that matters.
Re:Go proposal: Leave “if err != nil” alone? by Symmetry on Friday June 28, 2019 @02:22PM (#20307338)
Well, there is one thing forcing you to handle errors, you have to deliberately suppress them or the compiler yells at you.

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.

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:

https://play.golang.org/p/in5pgl11fO7

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?
Re:Go proposal: Leave “if err != nil” alone? by feadog on Friday June 28, 2019 @06:12PM (#20309192)
You mean a CarlyRaeJepsen monad? A "Call Me Maybe?"