Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

And in case of exceptions, why would that be useful?

(For other things, I agree that sum types are cool, and fortunately are supported in Java through sealed classes)



I don’t think sealed classes offer exhaustive pattern matching. Instead you have an if-else ladder of instanceof checks. This is not the same as most union type implementations.


They do with switch expressions. It is only type based for now, but deconstructs are coming with full blown pattern matching a la Haskell.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: