Scala.js Semantics - and how they support performance and JavaScript interop - Sébastien Doeraene

41:45 468 views 67% Published 6 years ago

Getting a language to compile to JavaScript is relatively easy. What's not so easy is: a) making it efficient and, most importantly, b) interoperating with JavaScript. For the latter, in particular, too many languages fail to provide consistent, easy to use and understand interoperability with JavaScript.

Scala.js is an exception to this rule: interoperating with JavaScript blends in the language itself and its semantics, up to the point where, seeing a piece of Scala.js code, you can hardly tell what is Scala.js and what is JavaScript. Basically similar to how Scala interoperates with Java. In this talk, we will explore the semantics of Scala.js, how they differ from those of Scala, and how they are, perhaps unexpectedly, equivalent to those of Scala. During this journey, we will see how they support almost transparent JavaScript interoperability. We will also cover the most important trade-offs that were made to allow the compiler to emit extremely efficient code for production, while retaining easy debugging during development. No previous knowledge of Scala.js, Scala, or JavaScript is required to follow this talk, although shallow knowledge of Scala and/or JavaScript will contribute to fully appreciate some details.

Slides here

Watch on YouTube