I am writing this article on my way back to New York, after a wonderful nescala 2015 in Boston. Definitely a grand cru. One of the hot topics there was Scala.JS, which is a technology we have recently started to use in banana-rdf. The various discussions and interactions I had during the conference made me realize this:
As one could have expected when someone makes such a prediction about programming languages, this sparked an interesting thread on Twitter :-) So let me try to refine what I think the value proposition is for Scala.JS and how I base it on what happened to Scala.
I don’t know many people who got interested in Scala for its own merits (I am not sure I know any…). In fact, we hear many voices pointing out its quirks, and they are real, but that misses the point: I don’t think that Scala would have become as mainstream as it is today if it was not for Java. Many of us came to Scala from Java because it hit a sweet spot: 1) it enables serious functional programming (no, lambdas are not enough…), 2) it gives us a richer and more robust static type system, and 3) it remains completely interoperable with Java. About that last point: we could code in Scala as if it were Java and easily interact with existing libraries.
2) I would claim that functional programming becomes interesting only when you are given a way to speak statically about the things you manipulate. This is why a robust and powerful type system is so important for so many people. Scala shines in that area. Look at projects like scala-js-jquery and imagine how easy it becomes to write jQuery code, being guided by the types while having the compiler checking for you that you are using the library correctly.
Then there is the obvious stuff: all of a sudden, plenty of efficient immutable datastructures and libraries from the Scala world become available in the browser; tools like IDEs finally become usable with code completion and type checking; the code can be optimized because the types are statically known; and finally, Scala.JS being just Scala, it comes with a rich ecosystem and community.
@bertails Isn't that what Coffee was supposed to be?— Robin Berjon (@robinberjon) February 1, 2015
@bertails @mandubian Clojure(Script) looks to me a better candidate on top of JS than Scala. much more close (loosely typed, functional)— Gaëtan Renaudeau (@greweb) February 1, 2015