Why do we need other JVM languages

前端 未结 17 2087
滥情空心
滥情空心 2021-02-02 10:30

I see here that there are a load of languages aside from Java that run on the JVM. I\'m a bit confused about the whole concept of other languages running in the JVM. So:

17条回答
  •  感动是毒
    2021-02-02 11:27

    Java has accumulated a massive user base over seven major versions (from 1.0 to 1.6). Its capability to evolve is limited by the need to preserve backwards compatibility for the uncountable millions of lines of Java code running in production.

    This is a problem because Java needs to evolve to:

    • compete with newer programming languages that have learned from Java's successes and failures.
    • incorporate new advances in programming language design.
    • allow users to take full advantage of advances in hardware - e.g. multi-core processors.
    • fix some cutting edge ideas that introduced unexpected problems (e.g. checked exceptions, generics).

    The requirement for backwards compatibility is a barrier to staying competitive.

    If you compare Java to C#, Java has the advantage in mature, production ready libraries and frameworks, and a disadvantage in terms of language features and rate of increase in market share. This is what you would expect from comparing two successful languages that are one generation apart.

    Any new language has the same advantage and disadvantage that C# has compared to Java to an extreme degree. One way of maximizing the advantage in terms of language features, and minimizing the disadvantage in terms of mature libraries and frameworks is to build the language for an existing virtual machine and make it interoperable with code written for that virtual machine. This is the reason behind the modest success of Groovy and Clojure; and the excitement around Scala. Without the JVM these languages could only ever have occupied a tiny niche in a very specialized market segment, whereas with the JVM they occupy a significant niche in the mainstream.

提交回复
热议问题