[Kc] exception handling in golang

David Nicol davidnicol at gmail.com
Fri Apr 26 14:31:54 PDT 2013


Yes indeed. their "defer" mechanism gets to be catch blocks as an extra
thing. I wonder if the Go compiler treats recover() specially to optimize
happy paths. It certainly could.

Go is the first compiled language I've seen with "Yoda's exceptions" as
discussed thirteen years ago on
the perl six development lists. They recommend against using them, and
didn't even bother to suggest repanicking with the received exception after
recovering an unexpected panic topic. Which is obvious to
anyone who likes exception-based control flow, so no hard feelings. I like
the way that the "defer" keyword, which is like on_exit from CPAN (my
version works better! prefer local$on_exit, it will continue to work right
even if garbage collection starts getting deferred) doubles as "catch."

On Fri, Apr 26, 2013 at 3:52 PM, Teal <ironicface at earthlink.net> wrote:

>  I think the go approach is pretty interesting.
> Seems to create some other possibilities besides just error handling.
>
> Teal
>

-- 
*indigestion from sufficiently magical technology is no advance*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/kc/attachments/20130426/fadf62f7/attachment.html>


More information about the kc mailing list