3 ms·
I think you might be able to trick the type checker to accept union types, but I'm not sure. I know intersection types are possible, but they are not really use
by PhilipRoman 3y ago
I think you might be able to trick the type checker to accept union types, but I'm not sure. I know intersection types are possible, but they are not really useful for exceptions.
Regarding practicality - I've used this feature when implementing a visitor class API, so it definitely has some use cases.
The biggest problem is that all it takes is a single method in the chain which does not support this pattern (think java.util.stream). For internal code it's pretty easy to decorate all functions that take callback lambdas, etc.