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


Couchbase Connect Goes Online
02/10/2020

Couchbase has virtualized its annual NoSQL developer conference, Couchbase Connect, and is offering three days of free content on Couchbase for developers - who can sit on their own com [ ... ]



Google Data Studio Improves Analytics
28/10/2020

Google Data Studio has been updated with a new connector for Google Surveys, and a new, more intelligent Google Analytics that uses machine learning to automatically bring insights to the surface.


More News

{laodposition comment}