I rag on “if err != nil { return err }”, but I can sort of understand where people who prefer it to try/exceptions are coming from, even though I completely disagree. But I can’t even begin to understand people who prefer hand-written state machines to async/await.
-
-
Invisible code paths are such a dangerous concept, IMO. In C++, there's a reason you have to manage resources with a designated class, and that's because an invisible error might be thrown, at best causing resource leaks.
-
Once you have panic exceptional control flow is something you will always have to deal with. The only alternative is panic=abort, which is a ship that’s long-since sailed in both Rust and Go.
- 1 more reply
New conversation -
-
-
Another advantage: You can unpack FooFailed to get at the error inside instead of having to treat the error as an opaque string.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
That is true. I never use panic for that reason.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.