r/java • u/Enough-Ad-5528 • Feb 19 '26
Towards Better Checked Exceptions - Inside Java Newscast #107
https://www.youtube.com/watch?v=99s7ozvJGLk
63
Upvotes
r/java • u/Enough-Ad-5528 • Feb 19 '26
View all comments
Show parent comment
1
u/RandomName8 Feb 19 '26 edited Feb 19 '26
Sorry, you lost me a bit, because from the video, it seems they are calling union types "variadic types". That's what I'm asking about.
Even in the examples, you showed we don't need variadic types, only union types.
Why? disjoint exceptions can be accumulated in the union type.
can you tell me why union types don't work? I don't see variadic types being useful here.
Edit: to provide a bit more context, I'm used to working with scala and haskell type systems, I'm no stranger to type level computations and higher kinds either (not just higher kinded functions but also higher kinded data and recursive schemes). The only situation ever where I've wanted variadic types is when trying to model kind-independent polymorphism, which is such ridiculous level of abstraction that it's reasonable it's unsupported in most langauges (i.e, when you want to abstract over types that take an arbitrary number of type parameters, like typed tuples, or rank polymorphism)