Bridging the tooling gap with Scala.js

Bridging the tooling gap with Scala.js

Scala.js is a tool for compiling your Scala code to JavaScript. This enables writing type-safe and robust front-end application, but have you ever considered what it can do for Scala tooling? In this talk we’ll see how Scala.js can bridge the gap between the Scala-based and the JavaScript-based tools we use every day as programmers.

C2bb0454c4af1a61e7f173d54ce17b0b?s=128

Gabriele Petronella

April 16, 2018
Tweet

Transcript

  1. Bridging the tooling gap with Scala.js

  2. me, hi!

  3. stuff I do

  4. Let's talk about JavaScript

  5. '' == false // true [''] == '' // true

    [[]] == 0 // true typeof document.all // undefined document.all === undefined // false document.all === null // false document.all == null // true Number.MIN_VALUE > 0 // true ['1','2','3'].map(parseInt) // [1, NaN, NaN]
  6. Built with JS desktop apps

  7. Built with JS mobile apps

  8. Built with JS backends

  9. Oh, right, and the

  10. It matters (like it or not)

  11. A story

  12. Mythical Trees and where to find them

  13. AST Explorer

  14. None
  15. First idea +-------------------------+ +------------------------+ | | | | | |

    | | | | | | | | source | | | +---------------------------------------> | | | | | | | | | | | | | | | AST EXPLORER | | JVM SERVER | | | | | | | AST | (SCALAMETA) | | | <---------------------------------------+ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +-------------------------+ +------------------------+
  16. downsides 4 loading time 4 extra infra

  17. Write a parser from scratch

  18. Scala.js?

  19. Scala.js!

  20. None
  21. Benefits 4 ! fast 4 ☁ no extra infra demo

  22. Fast forward a few weeks

  23. None
  24. First idea +-------------------------+ +------------------------+ | | | | | |

    | | | | | | | | source | | | +---------------------------------------> | | | | | | | | | | | | | | | VSCODE | | SCALAFMT CLI | | | | | | | formatted source | (JVM) | | | <---------------------------------------+ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +-------------------------+ +------------------------+
  25. Downsides 4 ! slow (for a single file) 4 "

    not self-contained
  26. Scala.js?

  27. Yep

  28. Upsides 4 ! fast 4 " self-contained Downsides 4 !

    config -> cross-platform HOCON is still meh
  29. Free ideas, grab them! 4 scalafmt on astexplorer.net 4 (alternatively)

    standalone playground on scalafmt.org 4 browser extension that formats code comments 4 scalafmt on scala native 4 GitHub app for scalafmt checks (talk to @laughedelic)
  30. Thanks