julianpeeters / avrohugger

Generate Scala case class definitions from Avro schemas
Apache License 2.0
201 stars 120 forks source link

Scala 3 support #149

Open aartigao opened 3 years ago

aartigao commented 3 years ago

Not an issue, just a question: now that Scala 3 is a reality, are there any plans to support it? Specially for UNION types and removing the Shapeless dependency? Thanks!

yzia2000 commented 2 years ago

I think shapeless 3 is out: https://github.com/dotty-staging/shapeless/tree/shapeless-3. However, dependency on scala-reflect will be a concern. Is this issue on the roadmap?

patryk-celinski commented 1 year ago

I'm struggling with updating the application using avrohugger from Scala 2 to Scala 3. I did extensive research on the matter.

shapeless-3 won't be much of help - avrohugger will need a complete rewrite to Scala 3. The thing is that Scala 3 removes the need for shapeless and if you look at shapeless 3 this is just a bunch of utils that help to automatically derive type classes - its more of a showcase of how cool Scala 3 is and shapeless is not needed anymore - than a newer version of shapeless.

In Scala 3 the Tuple type is a replacement for HList so generic programming is becoming a language-level feature. Tuples are covering the Product side of the problem, there is a problem with Coproduct/Sum side (related to inheritance, sealed traits family, enums basically) that they don't have their counterparts in Scala 3. It requires expertise in Scala 3 metaprogramming to recreate them - not sure if just inlining + type class derivation, or macros would be needed by avrohugger to update to Scala 3. I think it will be much easier than updating avrohugger to Scala 3 would be writing a new avrohugger-3 using Scala 3 features from start.

patryk-celinski commented 1 year ago

I found out that avrohugger uses treehuger that uses scala 2.12 - which also affects the chances of updating this project to Scala 3. Probably in Scala 3 build treehugger can be replaced only by Scala 3 macros.

vesko-vujovic commented 11 months ago

Are there any updates about plans to rewrite everything in Scala 3? Is this in the roadmap?

julianpeeters commented 10 months ago

Thanks for the helpful assessments, and inquiries. Long term, Scala 3 is a "yes", but I don't foresee having concrete plans or an ETA (PRs welcome, of course).

Current status: crossbuilding for 2.12, 2.13, and 3