With JavaScript becoming one of the most widely used languages around, I began asking myself why people do not find ways to use it extensively on the JVM. As a programmer who spends half day writing Java, and the other half, writing JavaScript, I do see a lot of potential in this.

Was it just the timing that shot Scala up straight? Or the nature of the language itself. Although JavaScript and Java are fundamentally different languages, it is certainly not a problem to compile JS to Java bytecode. That's what Rhino has been doing for many years, right? Or the maybe the problem lies in the performance?

Whatever it is, I would be interested to know.

closed as primarily opinion-based by gnat, Ixrec, user22815, durron597, Dan Pichelman Apr 28 '15 at 2:00

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 8
    Snarky answer: Because Scala was designed, not grown. Less snarky answer: JS has only very recently become popular, and I still don't know many people who use it for any reason other than they're forced to by virtue of it being the only choice for the browser. – Phoshi May 20 '14 at 8:48
  • 3
    Scala dominates? Never noticed. – jwenting May 20 '14 at 10:12
  • 1
    I assumed that Java and Groovy dominated JVM, while Scala and Clojure are fighting for 3rd/4th place. At least it's my experience. While Scala is probably my favourite language, it's a bit too flexible, multiple people can essentially write same functionality in completely different ways, some of them are hard to understand by people without formal education. – David Sergey May 20 '14 at 11:21
  • 2
    I think your question is based on faulty premises, but for whatever it's worth mutability and dynamic typing are anti-patterns, and dynamic typing is made even worse by type coercions. – Doval May 20 '14 at 12:02
  • Isn't that what Rhino is? – Florian Margaine May 20 '14 at 13:27

Scala had a considerable head start over the recent popularity of JavaScript, but that is not the only reason. Scala is intimately connected to the specification and implementation of Java. It was written by the principal author of javac specifically to fix all the perceived flaws in Java that he wasn't able to overcome during the earlier project. To M. Odersky, Scala is the perfect language for competent programmers that can run on the JVM without requiring incompatible changes. It is hard to imagine another alternative language that was better poised to win the "alternative" crown, and it didn't happen.

Not the answer you're looking for? Browse other questions tagged or ask your own question.