Skip to content

Create Scala-3 StdLib artefact #22043

Open
@odersky

Description

@odersky

Currently, the Scala 2 standard library is compiled with Scala 2. We would like to add extensions that are defined in Scala 3 and are meant to be consumed primarily by Scala 3. The problem is how to do that without introducing a split in the ecosystem.

Where we are today:

  • We can compile most of the Scala 2 standard library with the Scala 3 compiler
  • We have a Mima tool in place that checks binary forward compatibility with the Scala-2 compiled version. Currently it needs to apply fairly extensive filters to pass.

The proposed scheme is to

  • create a fork of the Scala 2 standard library,
  • add Scala 3 specific definitions to it
  • compile with Scala 3
  • check that the resulting library is binary compatible.

Projects that consist of 100% Scala 2 would continue to use the Scala-2 compiled library. Mixed projects would use the
newer Scala 3 library. The purpose of this issue is to identify all problems we need to fix before we can roll this out. Here are some to start with, please add others in the comments:

  • Make sure we achieve full binary compatibility between the two libraries. This will probably need a bunch of sub-issues that identify individual incompatibilities.
  • Handle root classes such as AnyVal, ot function and tuple types. The idea is to copy the Scala-2 classfiles as they are into the Scala 3 library, not try to recompile them with Scala 3.
  • Handle @specialized. Again, we could copy class files that use it as they are into the Scala 3 library. There are not that many outside of functions and tuples anyway.
  • Solve the Scala-2 side problems that could arise from having to read a later Scala 3 library using TastyReader. Alternatively, sunset TastyReader and don't support Scala2 modules relying on Scala 3 modules anymore.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions