Programming language: straight from Scala.js to version 1.0 at home

Programming language: straight from Scala.js to version 1.0 at homeThe Scala-to-JavaScript compiler was not considered experimental for four years, but the big step to 1.0 is not until 2020. The Scala.js developer has announced the first release candidate for the 1.0 version of the Scala-to-JavaScript compiler. The finished version is scheduled for late January 2020. The 1.0 release emphasizes project maturity for production use and is designed to ensure backward compatibility with future minor releases.

Behaviour globally
Scala.js 1.0 hasn’t changed much since it focused on simplicity instead of new features when compared to version 0.6.x. However, significant changes in JavaScript global references have made and @JSGlobalScope javascript global, no longer access to global objects.

That is, you can only access objects that have both statically defined and allowed JavaScript identifiers. This means that the following line of code in Scala.js 1.0 causes a compilation error.

Val pathname = “math”
println ( (pathname))

println (`not-a-valid-JS-identifier`)
The last line of access uses an unauthorized name for the identifier and the second line is defined at Math runtime. Access base object with same name

println (
Allowed because it is statically defined.

A positive side effect of referencing the global scope is that Scala.js require () can access global variables that provide special variations by default, such as Node.js.

Better nesting
Using version 1.0, Scala.js simplifies the definition of base inner classes. Up to version 0.6.x required a rather cumbersome procedure. It can also be used in non-native nested JavaScript classes js.constructorOf.

Among them, it is worth mentioning that the compiler-generated it with native ES2015 code, while the old model was still compiled with ES 5.1, which is no longer used in strict mode. However, the latter can be further generated through sbt’s modified settings.

ScalaJSLinkerConfig in ThisBuild ~ =
{_.withESFeatures (_. withECECScript2015 (false))}
Disposal Polluted Site
To jump to version 1.0, the developer cut off some old strings. For example, the compiler does not support Scala 2.10.x or minor versions 2.11.0 to 2.11.11, but 2.11.12 is still allowed in 2.11.series. Regarding the Java Development Kit, the compiler gives up versions 6 and 7. Using the build tool set, Scala.js requires version 1.2.1 or later, but older versions still used sbt 0.13.x.

Elements obsoleted in version Scala.js 0.6.x will disappear in version 1.0. Therefore, the Scala.js team recommends compiling an existing project first with Scala.js 0.6.31 and dealing with deprecated warnings.

Long way home
Scala.js looks back on 6 years of history. The compiler was like a Scala programming language at the Lausanne Federal Institute of Technology (EPFL). Early in the release of version 0.6, developers have already certified some maturity for professional use in 2015 by no longer marking tools as experimental.

Martin Odersky, the founder of Scala, sees the compiler as an important pillar of the programming language. In an interview with Heise Developer, he told Scala.js: “This is a very powerful implementation, but currently it’s mainly used by Scala developers who want a front end, but Scala.js thinks so too. You can see others coming from JavaScript.

More information about the release candidates for Scala.js 1.0 can be found in the official announcement

Leave a Reply

Your email address will not be published.

%d bloggers like this: