I have implicit conversions for types defined in a package (not classes, type aliases), so I need to locate them in the same namespace to be inside the implicit search scope. Scala 3 allows top level package definitions. That’s great. But package objects can extend LowPriorityImplicits
-like traits, allowing to introduce precedence between several type classes. What’s the best path in adapting this to Scala 3, which will not cause several source incompatibility?
I know I can use opaque
types instead of type aliases, and put the type classes to their companion object, which, obviously, can extend ‘low priority’ traits, but that means both that my Scala 2 and Scala 3 code diverges to a point severly impacting the ability to introduce changes in a coordinated manner (not cross compiling, but applying patches or cut&pastes with minimal effort), and that it might severly break client code sources (binary compatibility is not my goal).
Another is to turn my package into a huge object, but value classes can be declared only in the object itself, and the idea of ten thousand lines of code in a single file terrifies me.
Do you have better ideas?