开发者

Scala: binary incompatibility between releases

开发者 https://www.devze.com 2022-12-16 08:58 出处:网络
Why is Scala binary incompatible between diffe开发者_JS百科rent releases?It has to do with the way traits are compiled, because traits are kind of like interfaces but they can contain implementation.T

Why is Scala binary incompatible between diffe开发者_JS百科rent releases?


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.


Here's background on this, straight from Odersky, if you want to understand the specific language issues that cause problems:

http://www.scala-lang.org/node/9346

It's worth reading in conjunction with this post from David Pollack if you are new to the issue and want to understand the impact this can have on applications:

http://lift.la/scalas-version-fragility-make-the-enterprise


I've implemented support for Scala in the japi-compliance-checker 1.6 and performed analysis of backward compatibility for all versions of Scala (both binary- and source-compatibility).

So now you can view breaking changes in details. The report is available here: http://abi-laboratory.pro/java/tracker/timeline/scala/

The report is updated every other day, so you can monitor changes in the recent versions of Scala.

Scala: binary incompatibility between releases


It's still relatively young and undergoing active development.

There are some changes in the new release that were anxiously awaited and that help with a lot of problems, but it wasn't possible to make them backward compatible.

Because Sun is kind of restrictive about updates, Java changes rather slowly, and usually tries to remain backward compatible to the bitter end. Sometimes this stands in the way of progress, but big companies love a stable language.

Scala, on the other hand, is in the hands of a small group of academics, and it's not (yet) widely used in the industry, so they have (or take) some more freedom with changes.


Umm, no. Get your facts straight. There was no recompilation needed* when going from 2.7.2.3b1 -> 2.7.2.3b2, which was a real relief for me because of the large customer base we had with entrenched legacy code using 2.7.2.3b1 features.

*Caveat - unless you foolishly used code in scala.collection._ or scala.xml._

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号