Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Casting Metals

Casting Metals

A historical perspective on Scala tooling, how Metals came to be and what we can expect for the near future.

Gabriele Petronella

September 21, 2019
Tweet

More Decks by Gabriele Petronella

Other Decks in Programming

Transcript

  1. CASTING METALS
    GABRIELE PETRONELLA

    View Slide

  2. CASTING METALS
    I’M GABRIELE
    ▸ Co-founder and Software Engineer at buildo
    ▸ Co-organizer of ScalaItaly
    ▸ Metals contributor

    View Slide

  3. CASTING METALS
    AGENDA
    ▸ Pre-Metals age
    ▸ Metals age
    ▸ …and beyond?
    Metals rich code editing for Scala in VS Code Vim Emacs
    By Ólafur Páll Geirsson
    https://www.youtube.com/watch?v=MRQMylDxBJ8

    View Slide

  4. QUICK SURVEY

    View Slide

  5. PRE-METALS AGE

    View Slide

  6. CASTING METALS
    2013 - PROJECT KEPLER
    ▸ aka macros for Scala
    ▸ Landed in Scala 2.10 together with scala.reflect
    ▸ Authored by Eugene Burmako at EPFL

    View Slide

  7. CASTING METALS
    2014 - PROJECT PALLADIUM
    ▸ ok, macros are great…
    ▸ …but can be also made easier to use?
    ▸ You may also know Project Palladium as Scalameta (at the time, scala.meta, for assonance with
    scala.reflect)

    View Slide

  8. CASTING METALS
    2014 - SCALAMETA
    ▸ Announced publicly in 2014 at ScalaDays by Eugene Burmako (“Rethinking Scala Macros”)
    ▸ Intended as a principled foundation for meta programming, intended for use in a new macro
    system

    View Slide

  9. View Slide

  10. IT DIDN’T
    Narrator
    CASTING METALS

    View Slide

  11. View Slide

  12. CASTING METALS
    2015 - SCALAMETA SYNTACTIC API
    ▸ By 2015, Scalameta syntactic API was ready for prime-time
    ▸ What is the syntactic API?
    ▸ Parser
    ▸ Data structures (Trees, Tokens)
    ▸ Pretty printer

    View Slide

  13. CASTING METALS
    2016 - SCALAFMT
    ▸ Code formatter for Scala, based on Scalameta
    ▸ Developed by Ólafur Páll Geirsson, as his
    master thesis at EPFL
    ▸ Presented at Scala Italy 2016, in Venice!

    View Slide

  14. CASTING METALS
    2016 - SCALAMETA SEMANTIC API
    ▸ The compiler knows a lot about your code
    ▸ Scalameta injects itself into the compiler, and it persists information about your code
    ▸ The information can then be re-used later on by external tools
    ▸ The data structure holding the information is known as Semanticdb
    ▸ See the very comprehensive spec https://scalameta.org/docs/semanticdb/
    specification.html

    View Slide

  15. TYPER BYTECODE
    SEMANTICDB

    View Slide

  16. CASTING METALS
    2016 - MIGRATE4S SCALAFIX
    ▸ The idea:
    ▸ Scalafmt can fmt your code
    ▸ Scalafix can fix it
    ▸ Born in response to the goal of “to define a migration path from Scala 2.x to Dotty”, which
    came up in the first Scala Center Advisory Board meeting
    ▸ Authored by Ólafur, who’s at the time was a software engineer at the Scala Center

    View Slide

  17. CASTING METALS
    NOVEMBER 2017 - SCALA.IO
    ▸ I had just given a presentation about Scalafix
    ▸ Scalafix can now migrate your code, but also warn about unwanted patterns
    ▸ It would be neat to have that in your editor!
    ▸ But how?

    View Slide

  18. CASTING METALS
    IDE
    IDE
    FEATURES
    EDITOR

    View Slide

  19. SERVER
    CASTING METALS
    CLIENT / SERVER
    CLIENT
    FEATURES
    EDITOR
    ?

    View Slide

  20. SERVER
    CASTING METALS
    CLIENT / SERVER
    CLIENT
    FEATURES
    EDITOR
    LSP

    View Slide

  21. CASTING METALS
    2016 - LANGUAGE SERVER PROTOCOL
    ▸ A standardisation effort made by Microsoft, in partnership with RedHat and Codenvy
    ▸ Created in the context of Visual Studio Code and open sourced on June 27, 2016
    ▸ Extensible and “negotiable”
    ▸ You can implement only part of it, client and server negotiate the supported features
    ▸ You can extend it with custom features

    View Slide

  22. CASTING METALS
    BACK TO NOVEMBER 2017

    View Slide

  23. CASTING METALS
    BACK TO NOVEMBER 2017

    View Slide

  24. METALS AGE

    View Slide

  25. CASTING METALS
    JANUARY 14, 2018 - NAMING IS HARD

    View Slide

  26. CASTING METALS
    2018 - POC PHASE
    ▸ Try doing everything!
    ▸ Entirely based on contributors’ free time
    ▸ It totally worked! Except for when it didn’t…
    ▸ “released” as 0.1.0

    View Slide

  27. rm -rf
    v0.1.0
    v0.3.0
    v0.4.0
    v0.5.0
    v0.6.0
    v0.7.0

    View Slide

  28. CASTING METALS
    DECEMBER 7, 2018 - METALS 0.3.0
    ▸ Build import
    ▸ Goto definition
    ▸ Accurate diagnostics

    View Slide

  29. CASTING METALS
    2017 - BLOOP
    ▸ Build server around Zinc, the Scala incremental
    compiler
    ▸ Other build tools can integrate with it
    ▸ Developed at the Scala Center by Jorge
    Vicente Cantero (in photo) and Martin Duhem

    View Slide

  30. CASTING METALS
    2018 - BSP
    ▸ Equivalent to LSP, but applied to build servers
    ▸ Joint effort of the Scala Center and the IntelliJ
    Scala team (Justin Kaeser, in photo)

    View Slide

  31. CASTING METALS
    BSP
    LSP

    View Slide

  32. CASTING METALS
    JANUARY 24, 2019 - METALS 0.4.0
    ▸ Find references
    ▸ Find symbols in workspace
    ▸ Symbol outline
    ▸ Formatting

    View Slide

  33. CASTING METALS
    APRIL 12, 2019 - METALS 0.5.0
    ▸ Completions
    ▸ Hover (aka type at point)
    ▸ Signature help (aka parameter hints)
    ▸ Code folding
    ▸ Document highlights

    View Slide

  34. CASTING METALS
    JUNE 11, 2019 - METALS 0.6.0
    ▸ Build import for Maven, Gradle and Mill

    View Slide

  35. CASTING METALS
    JUNE 28, 2019 - METALS 0.7.0
    ▸ Tree view
    ▸ Project explorer
    ▸ Libraries explorer
    ▸ Compilation explorer

    View Slide

  36. CASTING METALS
    SOON (LIKELY 0.8.0)
    ▸ Debugging support
    ▸ Pants integration
    ▸ Find implementations

    View Slide

  37. …WHAT NOW?

    View Slide

  38. CASTING METALS
    SCALA 3 + METALS =
    ▸ semanticdb-scalac compiler can be replaced by TASTY
    ▸ Dotty presentation compiler is developed with tooling in mind

    View Slide

  39. I WILL PERSONALLY WORK WITH OTHER PEOPLE ON
    THE DOTTY TEAM, WITH SCALA CENTER AND WITH
    VIRTUSLABS TO INTEGRATE METALS WITH TASTY
    AND THE DOTTY PRESENTATION COMPILER
    Martin Odersky - September 13, 2019
    CASTING METALS

    View Slide

  40. GOLDEN AGE
    OF SCALA TOOLING
    WE’RE ABOUT TO ENTER THE

    View Slide

  41. THANK YOU
    @GABRO27
    METALS.ROCKS
    WE’RE HIRING!
    BUILDO.IO/CAREERS

    View Slide