News for hackers. Stuff that matters.
Re:Exploring Error Handling Patterns in Go by lucio on Thursday August 16, 2018 @01:47AM (#17772232)
Let's imagine a syntax-sugared Go...

Every function has a hidden "err" return value

Every function has an "exceptionExit:" block, by default it does just "return err;"

After every function call, an automatic "if err != nil {goto exceptionExit}" is added.

You can add an "exception" block to a function, it replaces the default.

Now you have function level exceptions in Go just by syntax sugar, without stack unwinding and without requiring new compiler functionality, just syntax sugar.

There are no comments on this comment yet.