tag:blogger.com,1999:blog-5722310642266356003.post2162704809216359865..comments2024-01-07T23:21:32.676+01:00Comments on The Axis of Eval: Happy Birthday GoUnknownnoreply@blogger.comBlogger2125tag:blogger.com,1999:blog-5722310642266356003.post-34517849863315263842011-11-11T22:35:33.090+01:002011-11-11T22:35:33.090+01:00I write a lot of Go and have mixed feelings about ...I write a lot of Go and have mixed feelings about its error-handling. However, I wouldn't change anything for lack of a better alternative.<br /><br />Maybe panic/recover are the "gratuitous concepts" mentioned? Recovering from a panic is intentionally a little inconvenient to discourage panics for everyday type of failures (file not found, etc.).<br /><br />Panics should happen only when there's a bug in the code. recover is there to save you from buggy code you didn't write or to make sure that your server never crashes, even if it fails.<br /><br />I think it's true that exceptions are abused in many languages. They occur all the time for very mundane reasons. I also think back on Raymond Chen's blogs on exceptions[1][2] and find it hard to disagree.<br /><br />At the same time, error codes are tedious. 90% of the time you're just letting errors trickle up to the caller and that's something exceptions do very well. Go's GC and defer mean there's less cleanup and fewer levels of indentation than the same code in C, but it's still painful at times.<br /><br />[1] http://blogs.msdn.com/b/oldnewthing/archive/2004/04/22/118161.aspx<br />[2] http://blogs.msdn.com/b/oldnewthing/archive/2005/01/14/352949.aspxEvanhttps://www.blogger.com/profile/10317078338290931726noreply@blogger.comtag:blogger.com,1999:blog-5722310642266356003.post-13474120488654648902011-11-11T10:40:44.759+01:002011-11-11T10:40:44.759+01:00It added panics later which is kind of exceptions ...It added <a href="http://golang.org/doc/go_spec.html#Handling_panics" rel="nofollow">panics</a> later which is kind of exceptions by another nameDaniel Yokomizohttps://www.blogger.com/profile/12528969103424062002noreply@blogger.com