softwaremill / magnolia

Easy, fast, transparent generic derivation of typeclass instances
https://softwaremill.com/open-source/
Apache License 2.0
768 stars 117 forks source link

Magnolia interface unification for Scala 2 and Scala 3 versions #458

Open YaroslavSagach opened 1 year ago

YaroslavSagach commented 1 year ago

In a process of migrating the project to Scala 3, I created a cross build. In which, I separated code with magnolia, that differs. So the Scala 2. code uses 1.1.3 version, and Scala 3 uses 1.2.6. Also, there is common code, which I want to keep for both versions. But, I've stumbled upon a problem, that those 2 versions of magnolia have different interfaces. In particular, I have a problem with CaseClass 'params'. In 1.1.3 it's "parameters", but in 1.2.6 it's "params" : https://github.com/softwaremill/magnolia/blob/27d0e677bc7e7e258d89afb5b34fd7f10c8cf07b/src/core/interface.scala#L109 https://github.com/softwaremill/magnolia/blob/2a2ecb8edb8f80b0bae49898962eac0d67dfbf78/core/src/main/scala/magnolia1/interface.scala#L546 So, is there any way to unify these interfaces, for such use cases like mine?

adamw commented 1 year ago

Yes, and I expect this might diverge further. For example, we'll be releasing magnolia 2 for scala 3 using a different package name (see https://github.com/softwaremill/magnolia/pull/457), and there might be more changes needed to support scala3-specific types. So I don't think having a unified interface will be possible in the long run.