Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scala: binary incompatibility between releases

Tags:

Why is Scala binary incompatible between different releases?

like image 588
Mohamed Bana Avatar asked Jan 12 '10 23:01

Mohamed Bana


People also ask

What is Scala binary compatibility?

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!)

Is Scala 2.12 backwards compatible?

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.

What is binary compatible and source compatible?

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.


2 Answers

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.

like image 131
Erik Engbrecht Avatar answered Sep 28 '22 09:09

Erik Engbrecht


Lack of JVM support for Scala-specific features, such as traits mentioned, and the fact that it is actively evolving.

like image 37
Daniel C. Sobral Avatar answered Sep 28 '22 11:09

Daniel C. Sobral