-
Notifications
You must be signed in to change notification settings - Fork 30
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
how to support 2.12/2.13 cross-building? #22
Comments
This might be a good usecase for |
For now I would suggest to put a dummy In the long run we'll need some compatibility library for 2.12 -> 2.13 collections migration where we can add this object. |
@szeiger That solution is not really acceptable: it leaks that dummy object down to other projects depending on your library. And if there are two such libraries, you now inherit from twice this dummy object on the classpath. That's too ugly to be a recommended default solution. |
Here is a non-leaking solution, fully source compatible across Scala versions (no need for CompatParColls.scala (private to the library) package test
private[test] object CompatParColls {
val Converters = {
import Compat._
{
import scala.collection.parallel._
CollectionConverters
}
}
object Compat {
object CollectionConverters
}
} Test.scala (actual code in the library that wants to use parallel collections) package test
import test.CompatParColls.Converters._
object Main {
def main(args: Array[String]): Unit = {
val argsInt = args.par.map(_.toInt)
argsInt.foreach(println(_))
}
} Gist: https://gist.github.com/sjrd/ccc2ec61a2ccbae1eb4ee9dea004b7a5 |
note that it's often possible to replace something like
with
which is fully source-compatible. |
We should provide 2.11 & 2.12 builds with a dummy |
Initial support for Scala 2.13 scala/scala-collection-compat#217 scala/scala-parallel-collections#22 scala/scala-collection-compat#208 Signed-off-by: 35V LG84 <35vlg84-x4e6b92@e257.fi>
…sier; add scala-2.13 profile to enable pulling in par collections library separately, for the future ### What changes were proposed in this pull request? Scala 2.13 removes the parallel collections classes to a separate library, so first, this establishes a `scala-2.13` profile to bring it back, for future use. However the library enables use of `.par` implicit conversions via a new class that is not in 2.12, which makes cross-building hard. This implements a suggested workaround from scala/scala-parallel-collections#22 to avoid `.par` entirely. ### Why are the changes needed? To compile for 2.13 and later to work with 2.13. ### Does this PR introduce any user-facing change? Should not, no. ### How was this patch tested? Existing tests. Closes #25980 from srowen/SPARK-29296. Authored-by: Sean Owen <sean.owen@databricks.com> Signed-off-by: Sean Owen <sean.owen@databricks.com>
Having now gone so long without providing empty 2.11 and 2.12 artifacts, my conclusion is that there isn't much demand and people are coping fine with what they have. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Ref scala/scala-parallel-collections#22 Parallel collection got split off without source-compatible library, so apparently we need to roll our own compat hack, which causes import not used, so it needs to be paired with silencer.
hey @szeiger if I need
import scala.collection.parallel.CollectionConverters._
before I can use.par
then how are library maintainers supposed to cross-build their code in 2.12/2.13?idea: should we add a dummy empty
scala.collection.parallel.CollectionConverters
class to Scala 2.12.2? if it has no runtime residue, doing so won't break binary compatibility as far as I can seeThe text was updated successfully, but these errors were encountered: