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.

scalajs

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.

 

scalajs 

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.

Banner


NIST Password Guidelines - The Nine Commandments
01/10/2024

The US National Institute of Standards and Technology (NIST) has issued the second public draft of the proposed new version of its Digital Identity Guidelines. It includes updated rules [ ... ]



Tcl/Tk 9 Released
01/10/2024

Tcl/Tk 9 has been released with changes including 64-bit capacity, and improvements to the handling of Unicode and encodings.


More News

{laodposition comment}