Skip to content

Commit c8af2e0

Browse files
authored
Merge pull request #3013 from lrytz/bin-compat-update
Updates to the page on binary compatibility
2 parents f767949 + a3ddf2f commit c8af2e0

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

_overviews/core/binary-compatibility-of-scala-releases.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,25 @@ Note that for Scala.js and Scala Native, binary compatibility issues result in e
1515
They happen during their respective "linking" phases: `{fast,full}LinkJS` for Scala.js and `nativeLink` for Scala Native.
1616

1717
#### Forward and Back
18-
We distinguish forward and backward compatibility (think of these as properties of a sequence of versions, not of an individual version). Maintaining backwards compatibility means code compiled on an older version will link with code compiled with newer ones. Forward compatibility allows you to compile on new versions and run on older ones.
18+
We distinguish forward and backward compatibility (think of these as properties of a sequence of versions, not of an individual version). Maintaining backward compatibility means code compiled on an older version will link with code compiled with newer ones. Forward compatibility allows you to compile on new versions and run on older ones.
1919

20-
Thus, backwards compatibility precludes the removal of (non-private) methods, as older versions could call them, not knowing they would be removed, whereas forwards compatibility disallows adding new (non-private) methods, because newer programs may come to depend on them, which would prevent them from running on older versions (private methods are exempted here as well, as their definition and call sites must be in the same compilation unit).
20+
Thus, backward compatibility precludes the removal of (non-private) methods, as older versions could call them, not knowing they would be removed, whereas forward compatibility disallows adding new (non-private) methods, because newer programs may come to depend on them, which would prevent them from running on older versions (private methods are exempted here as well, as their definition and call sites must be in the same source file).
2121

2222
#### Guarantees and Versioning
2323
For Scala 2, the *minor* version is the *third* number in a version, e.g., 10 in v2.13.10.
2424
The major version is the second number, which is 13 in our example.
2525

26-
Scala 2 guarantees both backward and forward compatibility across *minor* releases within a single major release.
27-
28-
These are strict constraints, but they have worked well for us since Scala 2.10.x.
29-
They didn't stop us from fixing large numbers of issues in minor releases.
30-
So far, that policy is still applicable for Scala 2, although [there exists a proposal to remove the forward compatibility guarantee](https://docs.scala-lang.org/sips/drop-stdlib-forwards-bin-compat.html).
26+
Scala 2 up to 2.13.14 guarantees both backward and forward compatibility across *minor* releases within a single major release.
27+
This is about to change now that [SIP-51 has been accepted](https://docs.scala-lang.org/sips/drop-stdlib-forwards-bin-compat.html), future Scala 2.13 releases may be backward compatible only.
3128

3229
For Scala 3, the minor version is the *second* number in a version, e.g., 2 in v3.2.1.
3330
The third number is the *patch* version.
3431
The major version is always 3.
3532

36-
Scala 3 guarantees both backward and forward compatibility across *patch* releases within a single minor release.
37-
In particular, this applies within an entire [Long-Term-Support (LTS) series](https://www.scala-lang.org/blog/2022/08/17/long-term-compatibility-plans.html) (which will start with Scala 3.3.x).
33+
Scala 3 guarantees both backward and forward compatibility across *patch* releases within a single minor release (enforcing forward binary compatibility is helpful to maintain source compatibility).
34+
In particular, this applies within an entire [Long-Term-Support (LTS) series](https://www.scala-lang.org/blog/2022/08/17/long-term-compatibility-plans.html) such as Scala 3.3.x.
3835

39-
It also guarantees *backward* compatibility across *minor* releases in the entire 3.x series, but not forward compatibility.
36+
Scala 3 also guarantees *backward* compatibility across *minor* releases in the entire 3.x series, but not forward compatibility.
4037
This means that libraries compiled with any Scala 3.x version can be used in projects compiled with any Scala 3.y version with y >= x.
4138

4239
In addition, Scala 3.x provides backward binary compatibility with respect to Scala 2.13.y.
@@ -72,8 +69,8 @@ At this point, you are likely going to run into bugs.
7269
Please report issues you find to its issue tracker.
7370

7471
#### Concretely
75-
We guarantee forwards and backwards compatibility of the `"org.scala-lang" % "scala-library" % "2.N.x"` and `"org.scala-lang" % "scala-reflect" % "2.N.x"` artifacts, except for
76-
- the `scala.reflect.internal` and `scala.reflect.io` packages, as scala-reflect is still experimental, and
72+
We guarantee backward compatibility of the `"org.scala-lang" % "scala-library" % "2.N.x"` and `"org.scala-lang" % "scala-reflect" % "2.N.x"` artifacts, except for
73+
- the `scala.reflect.internal` and `scala.reflect.io` packages, as scala-reflect is experimental, and
7774
- the `scala.runtime` package, which contains classes used by generated code at runtime.
7875

7976
We also strongly discourage relying on the stability of `scala.concurrent.impl`, `scala.sys.process.*Impl`, and `scala.reflect.runtime`, though we will only break compatibility for severe bugs here.
@@ -83,4 +80,7 @@ Forward compatibility is only guaranteed for `3.N.y` within a given `N`.
8380

8481
We enforce *backward* (but not forward) binary compatibility for *modules* (artifacts under the groupId `org.scala-lang.modules`). As they are opt-in, it's less of a burden to require having the latest version on the classpath. (Without forward compatibility, the latest version of the artifact must be on the run-time classpath to avoid linkage errors.)
8582

86-
Finally, from Scala 2.11 until Scala 2.13.0-M1, `scala-library-all` aggregates all modules that constitute a Scala release. Note that this means it does not provide forward binary compatibility, whereas the core `scala-library` artifact does. We consider the versions of the modules that `"scala-library-all" % "2.N.x"` depends on to be the canonical ones, that are part of the official Scala distribution. (The distribution itself is defined by the `scala-dist` maven artifact.)
83+
#### Build Tools
84+
Build tools like sbt and mill have assumptions about backward binary compatibility built in.
85+
They build a graph of a project's dependencies and select the most recent versions that are needed.
86+
To learn more, see the page on [library dependencies](https://www.scala-sbt.org/1.x/docs/Library-Dependencies.html) in the sbt documentation.

0 commit comments

Comments
 (0)