vickumar1981 / stringdistance

A fuzzy matching string distance library for Scala and Java that includes Levenshtein distance, Jaro distance, Jaro-Winkler distance, Dice coefficient, N-Gram similarity, Cosine similarity, Jaccard similarity, Longest common subsequence, Hamming distance, and more..

Home Page:https://vickumar1981.github.io/stringdistance/api/com/github/vickumar1981/stringdistance/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Upgrade to Scala 3

vickumar1981 opened this issue · comments

  • 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.
  • 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?

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 compiling to 2.12 and even 2.11 might actually be a blocker.

this issue: #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.

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.

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

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.