Why do we need other JVM languages

前端 未结 17 1539
滥情空心
滥情空心 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:22

    The .NET languages are more for show than actual usefulness. Each language has been so butchered, that they're all C# with a new face.

    There are a variety of reasons to provide alternative languages for the Java VM:

    • The JVM is multiplatform. Any language ported to the JVM gets that as a free bonus.
    • There is quite a bit of legacy code out there. Antiquated engines like ColdFusion perform better while offering customers the ability to slowly phase their applications from the legacy solution to the modern solution.
    • Certain forms of scripting are better suited to rapid development. JavaFX, for example, is designed with rapid Graphical development in mind. In this way it competes with engines like DarkBasic. (Processing is another player in this space.)
    • Scripting environments can offer control. For example, an application may wish to expose a VBA-like environment to the user without exposing the underlying Java APIs. Using an engine like Rhino can provide an environment that supports quick and dirty coding in a carefully controlled sandbox.
    • Interpreted scripts mean that there's no need to recompile anything. No need to recompile translates into a more dynamic environment. e.g. Despite OpenOffice's use of Java as a "scripting language", Java sucks for that use. The user has to go through all kinds of recompile/reload gyrations that are unnecessary in a dynamic scripting environment like Javascript.
    • Which brings me to another point. Scripting engines can be more easily stopped and reloaded without stopping and reloading the entire JVM. This increases the utility of the scripting language as the environment can be reset at any time.

提交回复
热议问题