Re:Things about programming I learned with Go
by eweise on Tuesday August 22, 2017 @11:27AM
(#15073329)
Checked exceptions suck. Every method has to explicitly throw them up to a higher level where they can be handled causing tons of useless boilerplate. Its much better to just let unchecked exception bubble to a higher level of the app. This is a best practice in java so letting the exception bubble all the way back to the user is just poor programming.
[ Parent
| on HN ]
Re:Things about programming I learned with Go
by erikb on Tuesday August 22, 2017 @01:15PM
(#15074434)
I have to google what the "checked" actually means. But in Java you can throw parent classes, in Python you don't need to declare them at all. And honestly having a bad implementation is still better than no implementation. The main point here is to get correct, helpful error reporting so people understand what's going on. If I spend another 4 hours debugging an error message that was actually just a warning and not a biggy at all I'm going to throw up.
Re:Things about programming I learned with Go
by alphaalpha101 on Wednesday August 23, 2017 @01:26AM
(#15078731)
That's exactly what you have to do in Rust anyway though.
Except instead of just writing `throws SomeError` in the declaration line of the function, you have to annotate virtually every line of your function with `?` and wrap the return line in `Ok(...)`.
Re:Things about programming I learned with Go
by steveklabnik on Wednesday August 23, 2017 @02:53PM
(#15084096)
The ? RFC did include a "catch" construct, and there's been some discussion about doing something more like "throws SomeError." We'll see!
Re:Things about programming I learned with Go
by alphaalpha101 on Wednesday August 23, 2017 @10:17PM
(#15087120)
It's far too late for "we'll see".