The last time Hackerfall tried to access this page, it returned a not found error. A cached version of the page is below, or clickhereto continue anyway

Scala.js no longer experimental | The Scala Programming Language

February 5, 2015

Written By: Sbastien Doeraene

Today, we announced the release of Scala.js v0.6.0, the Scala to JavaScript compiler, and dropped the experimental flag associated to it. Yes, you read it right: Scala.js is no longer experimental! After exactly 2 years of development, we finally feel comfortable calling it production-ready.

Note, however, that Scala.js is not part of the Typesafe Reactive platform. Thus, although we consider Scala.js production-ready, Typesafe does not provide any commercial support for it.

More than a compiler, an entire ecosystem

At its core, Scala.js is a compiler from Scala to JavaScript. It compiles .scala files to a single optimized and minimized .js file per application. The resulting JavaScript code is vanilla ECMAScript 5.1, which therefore works everywhere on any OS, any browser, or even on Node.js. Just like regular Scala, you get all the powerful language features that you know and love: type inference, classes, traits and objects, pattern matching, the collections library, implicits, etc. And, in the same way that Scala is fully interoperable with Java, Scala.js is fully interoperable with JavaScript. Scala.js can interoperate with JavaScript either in a statically or dynamically-typed way.

While that all sounds great, a compiler would be nothing without an ecosystem of libraries and tools. Scala.js has that covered too!

You can use your favorite IDE to develop in Scala.js, and from experience, we can report that IntelliJ IDEA and Eclipse both provide a flawless development experience. Other editors should also work well. With Scala.js tooling, you get syntax highlighting, code completion (even for JavaScript libraries and the DOM!), jump-to-definition, and most other features you come to expect in a Scala tooling environment. After all, Scala.js is just Scala. Though, your IDE wont be able to run or debug Scala.js code. For that, you can use a browser, and you can even step through your Scala code because Scala.js emits source maps.

Building Scala.js libraries and applications is easy there is an sbt plugin, which gives you the same comfort and development speed as with Scala on the JVM. It can even run unit tests automatically with either Rhino, Node.js or PhantomJS, according to your needs.

Scala.js also has a growing ecosystem of libraries, which you can depend on through Maven dependencies (libraryDependencies in sbt). They cover UI frameworks, statically-typed client-server communication, reactive extensions, and so on. Several popular Scala community libraries such as Shapeless and Scalaz cross-compile with Scala.js.

Finally, were proud that Scala.js has a thriving community of nice and helpful people. Ask questions on StackOverflow, discuss on the mailing list, and discuss with us in the Gitter chat room.

Why Scala.js is awesome

Weve asked developers who use Scala.js daily why they think Scala.js is awesome. Here is a distilled version of what they have answered, in decreasing order of how many people mentioned it. You can read the entire discussion on the mailing list.

Here are also a few selected quotes from the mailing list discussion.

Its mostly about the strong typing for me. Nothing revolutionary about that idea, but its just as true on the client as on the server: having the compiler type-check your code makes it much quicker to get complex, sophisticated systems up and running.

Also, having the same language, end-to-end, is fabulous. [] With Scala.js, for the first time ever, I have a single solid, strongly-typed language that I can use throughout the system from the fiddly details of the UI, through the API definitions and the front-end web server, to the Akka middleware and the database back end. Thats really kind of amazing. It is also why I personally think Scala.js is the killer app for Scala as a language. Justin du Cur

In a lot of ways, Scala.js frees your Scala code from the confines of the headless Linux server that its been running on for years. Scala might be a nice language, but youve never been able to use it to make anything cool that a non-backend-systems person would understand. [] With Scala.js, you can easily create small Scala applications and email the tiny 100kb executables (or just the link to them) to anyone, who can run them on any modern device, even smartphones. Made a cute game? A fun visualization? An animated sequence? Now you can show the world.

Scalas no longer just for distributed systems people and type-theorists! Li Haoyi

Before Scala.js I did investigate using Opa as another approach to get End-to-End type safety. The problem I had there was that to do JavaScript interop, I had to drop down from Opa into Ocaml and write out manual bindings to the JavaScript library I wanted to use. Scala.js approach is infinitely better. Despite how much better I think typed libraries are, that does not negate the fact that there are good and useful JS libraries out there, and the ability to hack it into Scala.js code effortlessly with js.Dynamic or add a typed facade if desired is fantastic. Nick Childers

I have done some work with GWT before and compared to that the first thing you will notice is that Scala.js is FAST. It compiles 100 times faster, yet it still outputs JavaScript that is both faster and smaller. Baldur Norddahl

Scala.js has very good tooling and very good documentation. If you already write JVM flavoured Scala you can be up and running in no time and write JS flavoured Scala. Guillaume Belrose

[] Scala.js has one of the smartest and most responsive communities I have ever seen. You, Li Haoyi, and many other posters here have contributed to making this platform welcoming to newcomers. The help Ive received here has encouraged me to learn Scala proper, as well as many interesting functional programming concepts. Travis Good

One of the biggest awesomeness of Scala.js is the core teams steady hands. Right from the get go, Scala.js showed a mature engineering approach where each release made a meaningful difference to user projects, vetted release-to-release compatibility, communicated breaking changes well in advance, maintained useful associated libraries, and let pragmatism win over everything else. As a result, even though this is such a new project, it doesnt feel risky to use it in real projects. Ramnivas Laddad

Scala.js is simply the best option available on browsers today, if youre looking for a language with a powerful yet flexible type system. Xavier Cho

Why remove the experimental flag now?

Many Scala.js users would say that it has been production-ready for quite some time already. Possibly as early as 0.5.0, which was released in June 2014. So why do we choose to remove the experimental flag now? What has changed?

The big difference is several different aspects of stability:

Of course, we must still be able to evolve the library and the builds, so things might become deprecated, and eventually removed, but will do so at a slower pace than before.

All things considered, this means that the code you write today, for Scala.js 0.6.0, will continue to work throughout 0.6.x and 1.x.y unchanged.

So why isnt it 1.0.0 already? It seems like these properties satisfy to the requirements of a 1.0.0 version. What are you hiding?

While from all user-visible points of view Scala.js is stable, there remains just one quasi-implementation detail which might have to change in future versions the format of the intermediate files of Scala.js, the .sjsir files. These files are essentially the Scala.js equivalent of .class files for the JVM. Were not yet completely certain that were settled on their format, so wed like to reserve the possibility of changing it in the coming months. Doing so means breaking binary compatibility (by definition), and therefore would require a change in major version number. So were not yet jumping to version 1.0.0 just yet this is so that we may give ourselves one last chance to modify the Scala.js intermediate format before we make the leap to our first major version.

Though, rest assured! Were confident that Scala.js is otherwise stable and ready for widespread adoption.

Getting started

There are three main ways to get started with Scala.js:

So go ahead! Use it, love it, and build the web applications of the future!

Continue reading on scala-lang.org