Why is Scala binary incompatible between different releases?
Language. When two versions of Scala are binary compatible, it is safe to compile your project on one Scala version and link against another Scala version at run time. Safe run-time linkage (only!)
So Scala 2.11 => Scala 2.12 is a major release. It's not a minor release! Scala major releases are not backwards compatible. Java goes to extreme lengths to maintain backwards compatibility, so Java code that was built with Java 8 can be run with Java 14.
Source: Source compatibility concerns translating Java source code into class files. Binary: Binary compatibility is defined in The Java Language Specification as preserving the ability to link without error. Behavioral: Behavioral compatibility includes the semantics of the code that is executed at runtime.
It has to do with the way traits are compiled, because traits are kind of like interfaces but they can contain implementation. This makes it so it is VERY easy to make changes that don't break source compatibility but break binary compatibility, because when you add a new method to a trait along with an implementation, you have to recompile everything that implements that trait so that they will pickup that implementation. There's probably other issues, too, but I think they're mostly along the same lines.
Lack of JVM support for Scala-specific features, such as traits mentioned, and the fact that it is actively evolving.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With