New `-source` flag
Not so much a Dotty language feature this time, so much as a new compiler feature: Martin has just dropped a PR for a -source
compiler flag, which is designed to help you manage compatibility between language versions.
I recommend reading the PR notes and comments for more information, but the high concept is that, in its various forms, this flag provides:
- Warnings about things that are going to break next version
- Some backwards compatibility with the previous version
- Code rewrites from version to version
Basically, the idea is for the compiler to provide some assistance in the upgrade process, on the theory that there’s going to be more flux than usual over the next few language revs, so they want to ease folks along through those transitions.
This tweaks some previous flag proposals, superseding some of them and trying to pull them together into a single consistent system, so if you’ve been paying attention to those flags it’s especially worth giving this one a look. (In particular, the previous -language:Scala2Compat
flag is now -source:3.0-migration
.) And keep in mind that this is as much a design as an implementation: there are several aspects that aren’t yet implemented.
As usual, this is a PR under discussion, not even remotely an official part of Scala 3 yet. But if you’re interested in the topic, check it out…