News for hackers. Stuff that matters.
Re:All Programming Languages are Wrong (2018) by lokedhs on Wednesday February 12, 2020 @03:16AM (#22306916)
There is no need to get rid of checked exceptions to fix that.

You need generics for exceptions. If the inner function can throw some exception, then it should be possible to declare the stream method that it will throw the same exception.

I believe that the JVM doesn't actually support this, so the reasons were got the horrible situation we're in is because they didn't want to sacrifice backward compatibility.

Re:All Programming Languages are Wrong (2018) by erik_seaberg on Wednesday February 12, 2020 @03:41AM (#22307056)
I think we're saying the same thing. If f(T) can return U or throw A or B or C, there needs to be a way to declare that Stream<T>#map takes a Function<T, U, A|B|C> and returns a Stream<U> or throws A or B or C. But that sum type A|B|C doesn't exist in Java if there's no common base class.