-
Notifications
You must be signed in to change notification settings - Fork 129
define the scala 2 macros in the scala 3 module #480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
# Conflicts: # build.sbt
| libraryDependencies ++= Dependencies.scalaLogging(scalaVersion.value, false), | ||
| ) | ||
|
|
||
| lazy val `integration-test` = project.in(file("integration-test")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is expected that external dependencies should be used, especially to test CrossVersion.for2_13Use3, Currently only local testing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SethTisue I will test CrossVersion.for2_13Use3 and CrossVersion.for3Use2_13 locally and release 4.0.0-RC1, what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the motivation for testing CrossVersion.for2_13Use3 and CrossVersion.for3Use2_13? if the library is published for both 2 and 3, then 2 users should use the 2 version, 3 users should use the 3 version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it because the macro for 2 is defined in 3? Because it's mentioned in the Scala documentation, to be honest, I'm not sure if it's necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it because the macro for 2 is defined in 3?
There's no such thing — Scala 2 macros and Scala 3 macros are entirely separate systems. There is zero interoperability of macros in either direction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for clarifying. Can I merge it? I have already preserved the 3.x branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no objection! starting a new 4.x series seems like an excellent idea to me. sorry for the delayed reply
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 users should use the 2 version, 3 users should use the 3 version
@SethTisue it's not the case if it's a transitive dependency in a mixed scala2/3 application.
For example you're using scala 2 for your main app, but your code depends on a scala 3 library which in turn depends on scala-logging for scala 3.
The only reason that wouldn't work traditionally is that the scala 3 library wouldn't include the scala 2 macros, but with this PR the scala 2 macros would also be included thus the macros could work on the scala 2 parts of your codebase.
This facility unlocks a lot of flexibility for upgrading large scala 2 projects piece by piece.
(Having said all that, I remember someone once showing me a technique where app developers can have both the scala 2 and 3 library both present as a whole in their app, which would be similarly flexible but simpler for the library maintainers.)
Continue pushing #415 forward. We still need some integration testing. It will close #415 and #350.
This implementation is also the most reasonable solution, so #350 will also be closed. Scala docs: https://docs.scala-lang.org/scala3/guides/migration/tutorial-macro-mixing.html#3-cross-validate-the-macro
This will be released together with SLF4J 2.x, Logback 1.5.x, and Java 21 in
4.0.0-RC.1. This is considering that these dependencies are all versions that have been released for a long time. After stabilization, it will be released to version 4.0.0 and will only be developed on version4. x. Therefore, the3.xbranch only supports vulnerability fixes for non-destructive dependencies.