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


Google Adds Open-Source Development Kit To Vertex AI
15/04/2025

Google has added an Agent Development Kit (ADK) to Vertex AI, along with an agent engine and an Agent2Agent protocol that provides agents with a common, open language for collaboration.  The anno [ ... ]



Why OpenSSF's Baseline Security For Open Source Projects Is Important
21/04/2025

The Open Source Project Security Baseline, or OSPS Baseline for short, is a new initiative by OpenSSF in an attempt to bolster the security posture of open source software projects.


More News

{laodposition comment}