I was listening to a Martin Odersky video recently where he attempts to explain the fundamental advantage of functional languages (such as Scala, but of course not necessarily Scala) over OOP or procedural languages.
To paraphrase, he explains that Moore's Law is failing us lately, and so to make processors "faster", instead of being able to double the number of transistors in the cores, CPU manufacturers are simply offering more cores. This in turn lends the CPU to being leveraged more fully by concurrent/multi-threaded applications. So that primary take away was: the more concurrent the application the more snippets of its code are running simultaneously on different cores, and with more cores on the CPU that overall faster the program executes.
So far, so good.
What he failed to explain (or more likely, what I failed to grasp) is why functional languages like Scala lend themselves to being more concurrent then other non-functional languages. Since we happen to be talking about the JVM space, let's do a quick comparison of Java and Scala. What is it about a Scala program that, if it were instead implemented in pure Java, would make it more difficult to parallelize/make concurrent, especially if its all compiling down to JVM bytecode and running on the same JVMs with the same native capabilities??
Meaning I have two JVM apps, App1 written in Java and App2 written in Scala. They both do the exact same tasks and accomplish the same things. Both get compiled down to JVM bytecode and are ran on the same computer with the same JVM installed on it. How is the Scala app able to "tap into" JVM capabilities that make it more suited for concurrency than the Java one (and thus, faster on a CPU with more cores on it)?