The new collections API (to be released with 2.13) is not always source compatible with the current collections API. We should be able to implement scalafix migration rules so that upgrading an application from 2.12 to 2.13 will be simple. However, this might not be enough for libraries, which aim to support several major Scala versions. Consequently, we have to find solutions to make it possible to cross-build between 2.12 and 2.13 despite the important API differences. The purpose of this thread is to list the use cases for which we need cross compatibility and brainstorm about possible solutions.
Once we will have a working scala-library that uses the new collections it will be simpler to try it on a corpus of open source libraries to get a precise idea of where breakages come from, but we already know some of them:
Some operations are still supported but have been moved around or renamed. For instance,
toIteratorhas been replaced with
iterator(). In such cases, we can either just not break the API and use the same method name as before (
toIterator) or introduce a deprecated alias.
Some operations have the same name but a different type signature. For instance, the
tomethod (like in
myList.to[Vector]) now takes a value instead of a type constructor as parameter (
myList.to(Vector)). Unfortunately, if we try to add an overload of
towith the old type signature we sometimes end up with overloading resolution ambiguities.
In last resort, library authors can use separate source directories for parts of code that are specific to a major scala version.
Let me know if you think I missed something!