3 ms·
> not adding exception sum types What's this mean?
by therealdrag0 7y ago
> not adding exception sum types
What's this mean?
- erik_seaberg 7y agoIdeally we want something like class Stream<T> { <R, X> Stream<R> map( Function<? super T, ? extends R, throws X> mapper ) throws X } and if you pass a function that throws, say, IOException and SQLException, then X=IOException|SQLException and that's what that call to #map throws. You can sort of do it by http://natpryce.com/articles/000738.html http://natpryce.com/articles/000738.html but you have to choose one base type and you can't make stdlib support it.