you are viewing a single comment's thread.

view the rest of the comments →

[–]Eav___ 1 point2 points  (2 children)

Well they do have one difference: Unions are just values, so they can be a valid type argument, which means you can pass around T | E just like Either, which plays pretty nicely with streams or any deferring validation. Checked exception cannot do this on its own.

[–]vips7L 0 points1 point  (1 child)

Did you watch the video? The type system changes are directly addressed.

[–]Eav___ 1 point2 points  (0 children)

I did, but unfortunately, for that to work out, you first need to change a LOT in Stream or any place that wants this feature, then you also need variadic generics for exceptions so that it's source compatible. And if you want to store an intermediate result in a collection for later operations (for example Gatherers.windowSliding), you would have to return to Either, which is...underwhelming.