Improving Scala 3 forward compatibility

After some more discussions (including the core compiler team) here’s my suggestion how to make the naming (in the compiler and in sbt, but also potentially in other build tools) consistent and less cryptic. If multiple entries exist in the same cell then they’re interchangeable (that’s in order not to break compatibility).


compiler (current) compiler (suggested) sbt (current) sbt (suggested)
compiler version
(e.g. for `sbt compile` or `sbt test:compile`)
scalac -version scalac -version scalaVersion := "3.1.2-RC1"

++3.1.2-RC1
scalaVersion := "3.1.2-RC1"

++3.1.2-RC1
version of produced TASTy files
(expressed with corresponding scala version;
validates references to scala stdlib API)
-Yscala-release 3.0 -scala-output-version 3.0 scalaVersion := "3.1.2-RC1"

++3.1.2-RC1
scalaOutputVersion := "3.0.2"
stdlib version used at runtime
(e.g. for `sbt run` or `sbt test`)
scala -version scala -version scalaVersion := "3.1.2-RC1"

++3.1.2-RC1
scalaOutputVersion := "3.0.2"
stdlib version declared as transitive dependency
in Ivy and POM files
(for compile time and runtime of dependent projects)
- - scalaVersion := "3.1.2-RC1"

++3.1.2-RC1
scalaOutputVersion := "3.0.2"
version of produced JVM bytecode
(validates references to JDK API)
-release 8 -java-output-version 8


-release 8
scalacOptions ++= Seq(
"java-output-version", "8")

scalacOptions ++= Seq(
"release", "8")
scalacOptions ++= Seq(
"-java-output-version", "8")

scalacOptions ++=
Seq("-release", "8")
version of produced JVM bytecode
(doesn't validate references to JDK API;
discouraged)
-Xtarget 8 -Xunchecked-java-output-version 8


-Xtarget 8
scalacOptions ++= Seq(
"-Xunchecked-java-output-version", "8")

scalacOptions ++= Seq(
"-Xtarget", "8")
scalacOptions ++= Seq(
"-Xunchecked-java-output-version", "8")

scalacOptions ++=
Seq("-Xtarget", "8")
7 Likes