|
|
|
|
|
by pharmakom
1723 days ago
|
|
All good improvements, but Java is missing some really key pieces: - pipe operator (or custom operators in general) - do-notation - tail call optimisation - currying / partial application - (better) type inference - expression orientated - less syntactic noise around function calls (fewer commas and parenthesis) - type-classes or even runtime generic information to work around that Some of the thing I’ve listed can never be added without dramatically changing what Java is. At that point it would be a new language. |
|
To get back to the subject of "good to great FP support", maybe we disagree fundamentally. Here are a few examples:
I would say that Rust is a good example of "great FP support". It's not a functional programming language, but it supports a lot of the patterns that make statically-typed functional programming languages effective. However, its DNA is still mostly "imperative programming language".
For "good FP support", I'd say TypeScript and C# are nice examples. C# has LINQ, pattern matching, records, optionals in a way. TypeScript has the usual JS stuff, plus the type system is nice. Both are lacking in some places. For example, in TypeScript/JavaScript, the usual map/reduce/filter are only functions on Array, and don't work with iterators.
To take the opposite view: what would be a functional programming language with good or great support for another paradigm? OCaml could be an example of good/great support for imperative programming. Scala has great functional programming and great object-oriented programming.