0

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.

5
  • 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. Commented May 20, 2014 at 8:48
  • 3
    Scala dominates? Never noticed. Commented May 20, 2014 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. Commented May 20, 2014 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. Commented May 20, 2014 at 12:02
  • Isn't that what Rhino is? Commented May 20, 2014 at 13:27

1 Answer 1

6

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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.