Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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.

share|improve this 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 at 8:48
3  
Scala dominates? Never noticed. –  jwenting May 20 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 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 at 12:02
    
Isn't that what Rhino is? –  Florian Margaine May 20 at 13:27

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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