go's panic correspond, if anything, to unchecked exceptions in Java and
they should be treated as such, i.e. they should never be caught and only
be thrown on a clear programmer error.
And once you restrict yourself to checked exceptions, there really isn't an
advantage of a try-catch over an if err != nil.

But, in any case, this discussion has been rehashed ad infinitum.

On Thu, Jul 7, 2016 at 1:28 PM, Martin Geisler <mar...@geisler.net> wrote:

> On Thu, Jul 7, 2016 at 9:44 AM, Dave Cheney <d...@cheney.net> wrote:
> > Hi Martin,
> >
> > Go doesn't have exceptions, it really doesn't. Some people like to
> pretend
> > that panic/recover are exceptions, but really they are not [1].
>
> Yes, sure, they're called something else :-) But they behavior matches
> what you get with exceptions in other langauges: stack-unwinding until
> you find a handler that deals with the error. True, in Go you need to
> manually check (with a type switch, maybe) that you can handle the
> error after you call recover() -- that's normally part of the syntax
> in other languages.
>
> > 1. https://golang.org/doc/faq#exceptions
>
> --
> Martin Geisler
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to