Scala.js Improves Operability
Written by Kay Ewbank   
Friday, 06 March 2020

Scala.js has been updated to version 1.0 following seven years of development. The new release offers improvements to its runtime performance, increased support for JavaScript libraries, and Improved portability with respect to Scala/JVM.

Scala.js consists of a compiler from Scala to JavaScript that compiles .scala files to a single optimized and minimized .js file per application. The resulting JavaScript code is vanilla ECMAScript so work across operating systems and browsers. Scala.js offers the Scala language features including type inference, classes, traits and objects, pattern matching, and the Scala collections library. In the same way that Scala is fully interoperable with Java, Scala.js is fully interoperable with JavaScript.


The developers of Scala.js describe version 1.0 as:

"the culmination of our efforts to simplify, specify, and future-proof all aspects of Scala.js, from the language semantics to the internal APIs"

While this is the first 1.0 release, there aren't many major changes. The only breaking change is to use the global scope rather than the global object.  This means that when a JavaScript environment provides a global variable, it will now be visible to Scala.js.

The new release also creates ECMAScript 2015 code by default, rather than the ES 5.1 strict mode output produced by earlier releases. The developers say this enables better display of stack traces and error messages in interactive debuggers. It also means that static fields and methods in JS classes are properly inherited, and the generated code is shorter.

Another improvement is that nested non-native JS classes expose sane constructors to JavaScript making it possible to declare non-native JS classes inside outer classes or inside defs, and use their js.constructorOf in a meaningful way.

The developers say that libraries will need to be recompiled and republished using Scala.js 1.0 to be compatible, but that several libraries at the core of the Scala/Scala.js ecosystem have already been published and are available for Scala.js 1.0. The list of libraries supporting the new version is available on GitHub.



More Information

Scala.js Website

Libraries Supporting Scala.js 1.0

Related Articles

Scala.js Exits Experimental Stage  

Scala 2.11 Released


To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.


Keep Track Of Java Features with JEP Search

Here we have a very practical resource for sorting, searching and filtering Java JEPs. But before we get to the details, what exactly is a JEP and why should we care?

PHP - Essential But Underappreciated

We always knew that PHP is the common server-side web technology. Even so, discovering PHP is used by almost 80% of websites and that the next most used server-side languages has less than 10% is some [ ... ]

More News

{laodposition comment}