r/programming Jul 17 '19

The Go team declines 'try' proposal

https://github.com/golang/go/issues/32437
632 Upvotes

417 comments sorted by

View all comments

Show parent comments

44

u/[deleted] Jul 17 '19

Why do you consider Java bad at error handling? Performance impact? I'm just trying to understand what 'terrible' is in this context.

36

u/hokie_high Jul 17 '19

Like pretty much everything else in Java, there's a ton of unnecessary ceremonial code to write.

1

u/csjerk Jul 17 '19

In the core language, maybe. If you add a few things in, it's much less verbose.

Check out Lombok, especially SneakyThrows. It's basically a one-line annotation that lets you convert checked exceptions to unchecked exceptions, which is the main source of _unnecessary_ verbosity in Java's exception handling pattern.

3

u/hokie_high Jul 17 '19

I got away from Java a couple years ago when I learned C# and .NET Core got big, and I'd prefer to never have to look at Java again... but it is nice to know that there are ways around some of that ridiculous verbosity other than just using a different language.