Re:Unchecked Java: Say Goodbye to Checked Exceptions Forever
by erik_seaberg on Thursday July 13, 2023 @10:05PM
(#36718592)
stream.filter(p) requires wrapping checked exceptions, or altering the language so that they’re no longer checked.
[ Parent
| on HN ]
Re:Unchecked Java: Say Goodbye to Checked Exceptions Forever
by chii on Thursday July 13, 2023 @11:27PM
(#36719139)
or you start doing monads instead, where p operates on a monad (aka, the Optional type).
Unfortunately, this ends up propagating out and your entire code base needs to also do this. Tho i reckon it will make your code better in the future, for a short term/temporary pain converting/adding breaking changes etc.
Re:Unchecked Java: Say Goodbye to Checked Exceptions Forever
by erik_seaberg on Saturday July 15, 2023 @12:10AM
(#36733343)
Yeah, switching to Scala or Kotlin would be the shortest path to do that.
Re:Unchecked Java: Say Goodbye to Checked Exceptions Forever
by masklinn on Friday July 14, 2023 @12:28AM
(#36719481)
You could also alter the langage woth for exceptions transparency (swift has something like that with “rethrows“).
I don’t think that’s close to sufficient to making checked exceptions work tho, let alone good.