Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plans for after Scala 3.0 #248

Open
ashawley opened this issue Aug 15, 2018 · 5 comments
Open

Plans for after Scala 3.0 #248

ashawley opened this issue Aug 15, 2018 · 5 comments

Comments

@ashawley
Copy link
Member

There's a proposal to remove XML literals in Scala 3 ("dotty") and replace them with an alternative interpolated string library. The library has macro code that makes sure the XML in the string is well-formed at compile time.

This proposal is a long time coming and is not a big surprise, but how will this affect the development of scala-xml library?

Here are a few considerations:

  1. When the hooks for providing XML literals are removed in Scala 3 ("dotty"), it should be no problem for scala-xml. The scala-xml code doesn't know anything about the compiler hooks. Further, there aren't any significant bits in scala-xml for providing XML literals that is worth removing. The only things is the scala.xml.Properties singleton, which is four lines of code. The code for XML literals is entirely in the compiler. That code is actually an optional dependency on scala-xml starting with the 2.13 compiler.
  2. For that reason, the implementation of XML literals doesn't immediately require a separate version of scala-xml for Scala 3 with the XML literal support removed. Theoretically, the library could be cross-compiled to work with Scala 2 and Scala 3.
  3. The proposed XML interpolation library is planning to support XML literals with strings and the macro support in the compiler.
  4. The proposed XML interpolation library is planning to provide XML values as scala-xml data model (scala.xml.Node and friends).
  5. To compile in Scala 3, the scala-xml test suite will need to switch to either constructor based XML values or the new XML interpolation.
  6. To avoid a circular dependency between the test suite and the XML interpolation library, it would probably be better to just include interpolation in this project as was proposed in Xml Interpolation #151 as scala-xml-quote and publish it as a separate jar.
  7. Right now the sbt build defines a JVM and ScalaJS projects. We'll need to add a project for scala-xml-quote (call itquote?).
  8. The new scala-xml-quote does have new dependencies (scala-xml and fastparse) that are fine since it's a new and separate library
  9. However, publishing milestone builds for the Scala compiler team will become more difficult with these new dependencies in the scala-xml build.
  10. The Scala compiler no longer depends directly on scala-xml in 2.13, and there shouldn't be any important parts of the toolchain that require scala-xml to bootstrap the compiler.

We should probably take the opportunity to make a major release (scala-xml 2.0) with some of the following changes:

  1. Add scala-xml-quote to the repo as proposed in Xml Interpolation #151
  2. Migrate test suite from XML literals to XML interpolation
  3. Deprecate code marked deprecated
  4. Drop build support for Scala 2.12
  5. Switch to actually using the new Scala 2.13 collections
  6. Fix deprecation warnings, e.g. "X in package scala is deprecated (since 2.13.0)"

We can probably expect breaking changes for Scala 3 ("dotty") that might require breaking changes to scala-xml. That could require a new major version of scala-xml, which would be 3.0 and make a nice correspondence with Scala 3's version number.

@ashawley ashawley changed the title Plans for Scala 3 "dotty" Plans for Scala 3.1 Jun 21, 2019
@smarter
Copy link
Member

smarter commented Aug 26, 2019

FYI, https://github.com/lampepfl/xml-interpolator contains a new xml interpolator implementation for Dotty, which is mostly complete (its usage of scala-parser-combinators should either be replaced by fastparse, or by a hand-written recursive descent parser like the one in https://github.com/scala/scala/blob/2.13.x/src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala). It'd be great to see it merged into this repo.

@ashawley
Copy link
Member Author

Merging an interpolator could be done. I probably wrote this above already, but the dependency on scala-xml has been removed from the Scala compiler in 2.13 and in sbt 1.2.x. This frees us to entertain significant changes and even introduce dependencies to scala-xml.

So will the interpolator work for Scala 2.12 and 2.13, as well? Or is it Dotty-only?

@smarter
Copy link
Member

smarter commented Aug 27, 2019

Dotty-only since it uses Dotty macros.

@Atry
Copy link

Atry commented Sep 6, 2019

Hi, how do you guys think about the name based XML literal proposal? I am working on the implementation of in Scala 2 recently, and looking forward to port it to dotty.

@ashawley ashawley changed the title Plans for Scala 3.1 Plans for Scala 3.0 May 27, 2020
@SethTisue
Copy link
Member

Here's where things stand currently:

  • We have already published 2.0.0-Mx milestones for various Dotty and Scala 3 prereleases.
  • Over at Release 2.0.0 (RC, then final) #432 we are in the end stages of planning a 2.0.0 final release that supports Scala 2.12, 2.13, and 3.0.

Any more ambitious changes remain future possibilities.

@SethTisue SethTisue changed the title Plans for Scala 3.0 Plans for after Scala 3.0 Mar 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants