stringdistance icon indicating copy to clipboard operation
stringdistance copied to clipboard

Upgrade to Scala 3

Open vickumar1981 opened this issue 4 years ago • 6 comments
trafficstars

  • Upgrade for use with Scala 3
  • Scala 3 has new keywords for doing type classes. Old Scala 2 way, should still work, but re-writing for Scala 3 style might break backwards compatibility with Scala 2.

vickumar1981 avatar Feb 20 '21 17:02 vickumar1981

  • Possible solution: create a new github repo for Scala 3, i.e. stringdistance3 that works for more up-to-date versions of the JVM (java 14+) and Scala 3+.

  • How are existing libraries that use the type class pattern and extend my library pattern migrating to Scala 3 and handling the more clear and concise way of dealing with the implicit keyword?

vickumar1981 avatar Jun 10 '21 17:06 vickumar1981

It's possible to migrate the project to Scala 3 while keeping a cross compilation target to both 3.X and 2.13. Old Scala implicits will still work, but I believe it is possible to replace them by the new language features without breaking compatibility (reference). I'm not sure if it is possible to compile to earlier versions though (i.e. Scala 2.12), but that shouldn't be a blocker in my opinion.

FlorianCassayre avatar Oct 10 '21 14:10 FlorianCassayre

@FlorianCassayre compiling to 2.12 and even 2.11 might actually be a blocker.

this issue: https://github.com/vickumar1981/stringdistance/issues/50, for example, was opened so that you can add this library as a dependency in Apache Spark. Spark, from what I understand, is still using older versions of the Scala compiler (<= 2.12). I would be inclined to just drop support for those versions, but I think some consideration has to be given to ML platforms where a fuzzy matching library might be used.

vickumar1981 avatar Oct 11 '21 01:10 vickumar1981

Thinking about this some more, I think we should target version 2.0.0 for Scala 3 and Java 14+. I think bumping to a new major version might be the easiest approach. I think that step 1 is to start a 2.0.0-SNAPSHOT branch, using Scala 3. I can start on it in the next few weeks.

vickumar1981 avatar Oct 29 '21 16:10 vickumar1981

Nice, happy to hear that. I also believe it should be the easiest solution since most libraries are using this pattern.

FlorianCassayre avatar Oct 29 '21 16:10 FlorianCassayre

Thinking about this some more, I think we should target version 2.0.0 for Scala 3 and Java 14+. I think bumping to a new major version might be the easiest approach. I think that step 1 is to start a 2.0.0-SNAPSHOT branch, using Scala 3. I can start on it in the next few weeks.

Um, allow me to disagree. The easiest approach is clearly to just cross-compile for Scala 3. You said that you need to keep a branch with the old syntax around anyway in order to support Scala 2.x, and that syntax is still fully supported by the Scala 3 compiler. So why bother with the new syntax? You can always switch to that once Scala 2.x support is no longer necessary.

mberndt123 avatar Jun 03 '22 23:06 mberndt123