scala-parallel-collections icon indicating copy to clipboard operation
scala-parallel-collections copied to clipboard

Accessibility of Splitter.remaining

Open mbovel opened this issue 2 years ago • 1 comments

Hi,

Scala parallel collections docs and MOOC mention a .remaining method on Splitter and a .splitter method on collections returning a Splitter: https://github.com/scala/scala-parallel-collections/blob/7bc6f6ee2942226bc5376eb80380e102c5a4c937/core/src/main/scala/scala/collection/parallel/ParIterableLike.scala#L48-L58

In practice, .remaining is actually defined on IterableSplitter: https://github.com/scala/scala-parallel-collections/blob/7bc6f6ee2942226bc5376eb80380e102c5a4c937/core/src/main/scala/scala/collection/parallel/RemainsIterator.scala#L366

And the .splitter method is package-private: https://github.com/scala/scala-parallel-collections/blob/7bc6f6ee2942226bc5376eb80380e102c5a4c937/core/src/main/scala/scala/collection/parallel/ParIterableLike.scala#L233

Why is that?

Is there a way to obtain an IterableSplitter from a collection using the public API?

In particular, a slide of the MOOC suggests this implementation of .fold on a Splitter:

image

How could I use it in practice, say on a ParVector?

mbovel avatar Apr 25 '22 16:04 mbovel

My use case is this example: https://scastie.scala-lang.org/ZmMbFnGHRnuO5c3ByKxT7A. I'd like to avoid the dirty hack to access a private method.

mbovel avatar Apr 25 '22 16:04 mbovel