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

Sealed classes still won't let you have e.g. String|Integer, though I'll grant you that java is certainly mainstream.


You don't really need `String|Integer`, for most usecases an isomorphic type that you can exhaustively pattern match on is more than enough, and sealed classes (along with the support in `switch` expressions) does exactly that.


Scala 3 has had union types for 4 years now. Scala can be used to do Haskell style pure FP, but with much better tooling. And it has the power of the JVM, you can fall back to Java libraries if you want.




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

Search: