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.


GitHub Announces AI-Powered Changes

GitHub has announced changes to its platform that will use AI "in every step of the developer lifecycle". The intention is to make natural language become the universal programming language. The annou [ ... ]

Microsoft Windows Announced 40 Years Ago

Although it didn't launch until 1985, Microsoft Windows was announced in November 1983. It signaled the move for users from the command line to a GUI environment, something that some programmers still [ ... ]

More News

{laodposition comment}