Developer Survey: Java Developers Are The Saddest And C++ Programmers Are The Oldest

I agree that lambdas and streams do not suddenly make Java a functional language.

However, it is quite debatable what a True Functional Language™ is. All FP languages have in common that functions, working directly with them as values, function composition, and having simple syntax for that play a big role in design and implementation, but it gets fuzzy after that.

For some people FP should only rely on functions, no objects, no reflection, no compile-time metaprogramming.

For some people it's only a true FP language if side effects can only occur when explicitly modelled.

For some people it's only true FP language if close to every data structure is immutable/persistent.

For some people it's only true FP language if it has static typing, and then for others only if it supports higher-kinded types, and yet for others only if that is supplemented by sufficient type inference.

I am sure I could find more.

The point is, if you take the union of all the opinions on what a true FP language should be and look what languages fit the bill there is not much left. Not Clojure, not Scala, maybe not even ML.

Saying Java (whether 8 or earlier) is a FP language is over the top. However, it was always possible to program in a functional style. Java 8, just further enabled that with more APIs etc. So saying Java 8 is sufficiently functional is not wrong, depending on how much FP the user deems sufficient.

Consider what I wrote above. For a fan of static typing who does not care too much about the language enforcing control of side effects ML, Haskell, Scala are all sufficiently functional, but Clojure or Scheme would not be.

A functional programming style usually avoids mutability, but it is still used in various places in ML and even in Haskell in a localized fashion (ST etc.). So, in the end a FP language is one that steers users to avoid <insert your requirements for FP>, and arguably Java 8 has helped to steer developers more to that. But while that does not make Java 8 a de facto FP language, saying the opposite (it is definitely not an FP language) is also not entirely true. Just look at Scala. It has a very strong community and support trying to promote and maintain a FP style of programming in the language, which is why many people consider it an FP. However, it certainly doesn't fit the bill of Haskellers if you look at how lenient it is in regards to mutability and object orientation. And you, personally might even tell me "well Scala is not a modern FP language", but you surely agree that it is more functional than Java, right? So what degree of "functional" is necessary to consider a language a True FP Language™. I believe the answer will always be quite subjective.

/r/programming Thread Parent Link - fossbytes.com