Scala, developed as a functional and object-oriented language for the JVM, is now multiplatform, with developers using it in abundance on JavaScript via Scala.js, Scala founder Martin Odersky says.
With Scala.js, developers write code in Scala, and that code is then compiled to JavaScript, analogous to using Microsoft's TypeScript. Developers can leverage their Scala skills in Web development. "[Scala is] very popular on JavaScript now," Odersky said at the Scala Days conference in San Francisco.
Scala "is no longer essentially a single-host language," Odersky said. "Now, essentially Scala.js is a grown-up language. People use it for production code." Part of the Scala project, Scala.js, also is high-performing, he added. "In quite a few benchmarks, Scala.js beats native JavaScript, which is quite remarkable. And it also deploys very, very fast," as well as offering type safety and interoperability with JavaScript libraries.
To boost platform independence for Scala on both the Java and JavaScript platforms, Odersky has proposed the Tasty file format, with Scala code compiling the same on both Java and JavaScript platforms. "[The Scalac compiler, pronounced "Scala C"] would essentially compile into [Tasty] and then depending on what your platform is, you would produce the JavaScript or the class files," he said. Tasty provides binary compatibility along with a better platform for tooling.
Odersky also described the Dotc [pronounced "Dot C"] compiler platform, intended to help eliminate bugs and produce a better understanding of the technology. "We want to clean up some of the parts of Scala," he said. Overall, Scala proponents seek to make the platform more powerful and simpler, said Odersky, as Scala has too many types. Plans call for eliminating existential types.
This story, "Scala.js lets you compile Scala to JavaScript" was originally published byInfoWorld.
No comments:
Post a Comment