by willtim · 6y ago · 0 comments
Scala is, first and foremost an OO language which embraces subtyping, class hierarchies and imperative programming, see for example its own collections library. As Java gets more and more FP features, there is a danger it will struggle to differentiate itself.
Functional programming is about programming with immutability first. So OOFP is about immutable objects. I go even further to say it is about objects with immutable interfaces, but the implementations can be imperative as long as encapsulation hides the mutable aspects from the user of the object. This is what you see in Scala's collections library: we use mutability inside the implementation but we expose an immutable API.
I gave an entire talk on that very topic at Scala Italy in 2019: https://vimeo.com/362001027
I completely agree with this. So perhaps I am being rather hard on Scala.
Decompiling a Scala .class file shows just how true this is.