Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

stream.filter(p) requires wrapping checked exceptions in p, or altering the language so that they’re no longer checked. Same with Runnable.


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.


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.


Yeah, switching to Scala or Kotlin would be the shortest path to do that.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: