Search code examples
scaladottyscala-3

How seamless will be dotty/scala3 integration with tech like scala-native and scala-js?


Are there any limitations we should be aware of? Will it require us to use some scalafix like tools? or will it work out of box?


Solution

  • Migration from 2.13 to 3.0 in general:

    • Dotty uses 2.13 collections so no need to change things here - as a matter of the fact 2.13 would be so close to 3.0 that maintainers decided to skip 2.14 release which was supposed to serve as a stepping stone
    • macros will need to be rewritten - that is the biggest issue, but library maintainers have some time to do it, and some are rewriting things even now (see quill)
    • there will be few deprecations, e.g. forSome syntax for existential types disappears (see: Dropped features on documentation)
    • libraries might need to extends themselves to support new stuff (union/intersection/opaque types) but until you start using new things in your code everything works as before
    • other than that old Scala code should work without any changes

    Scalafix is being used on prod even now, e.g. Scala Steward is able to apply migrations as it updates libraries to a new version.

    Scala.js is already supported as Dotty backend next to JVM one.

    Recently Scala Center took over Scala-native, so we should expect that Scala-native development will speed up (it was a bit stalled) and it should eventually land as another supported backend. I cannot tell if they manage to deliver before the release of Dotty, but I doubt it. For now, Scala-native would have to get support for 2.12 and/or 2.13 first. Trace this issue if you want to know or ask on Gitter.

    Long story short: you would need to wait for libraries you use to get ported to Dotty, then update your macros if you wrote any, besides that migration should be pretty much straightforward for JVM and JS backends. Scala native will probably take more time.