|
|
|
|
|
by pharmakom
1244 days ago
|
|
The major differences between Java and F# are: - Discriminated unions and pattern matching - Global type inference - Tail call optimisation - Syntactic sugar for monadic code (computation expressions) Java is more “FP” than it used to be, but it is still not minimum viable FP |
|
For sum types, the syntax is like this:
I do like global type inference, but for anything that gets committed I often come to prefer at least Rust’s restriction of top level definitions needing types, as that aligns well with how I would also write Haskell and alia. Java imo made a good decision of only adding optional local inference, anything else would have been too disruptive for Java, given its existing talent pool’s background.