News for hackers. Stuff that matters.
Re:Unchecked Java: Say Goodbye to Checked Exceptions Forever by spion on Thursday July 13, 2023 @10:45AM (#36709990)
Exceptions are not unsafe.

That said, not modelling them in the type system is a mistake. But the model has to be useful - knowing what functions can or cannot throw is useful, knowing what they throw, less so.

(They are safe because of try-finally / try-with-resources)

Re:Unchecked Java: Say Goodbye to Checked Exceptions Forever by bedobi on Thursday July 13, 2023 @11:10AM (#36710436)
They are unsafe because they invariably result in people either ignoring them or catching more than they should, or less than they should, and the compiler happily lets you do that, EVEN when you're using checked exceptions.
Re:Unchecked Java: Say Goodbye to Checked Exceptions Forever by AnimalMuppet on Thursday July 13, 2023 @05:13PM (#36716060)
How will the compiler let you catch less than you should when using checked exceptions?
Re:Unchecked Java: Say Goodbye to Checked Exceptions Forever by spion on Thursday July 13, 2023 @08:46PM (#36718069)
There is no should/shouldn't. If you don't have a specific error in mind and how to handle it, you shouldn't handle it. In practice most errors can be left unhandled all the way to e.g. server response, so this works quite fine. `try-with-resources` is typically awkwardly implemented unfortunately (defer is nicer, the new `using` keyword in JS is quite nice too)
Re:Unchecked Java: Say Goodbye to Checked Exceptions Forever by bedobi on Friday July 14, 2023 @09:28AM (#36723720)
I don't mean to be uncharitable but it seems like most exception advocates here don't really understand the case us functional error handling advocates are making. We don't advocate handling errors at every level. They're usually sent to the boundary layers of the system, eg the http resource layer, and folded there into http responses. The safety case we're making has nothing to do with try catch finally, it is about signatures and what callers are forced and allowed to do.