Skip to content

Commit

Permalink
Deprecates Par*View and Gen*View
Browse files Browse the repository at this point in the history
In 2.12, this gives us the option to move the code from
Gen*View down into *View. If we don't do something more
drastic with views, which inertia and history suggests
is a real possibility, we can at least shed a little of
the implementation.

These abstractions are *only* used to share implementation;
there is no `view` method available on, for instance, `GenSeq`
that lets one abstract over parallel/sequential collections
while spawning views.

  scala> (List(1): collection.GenSeq[Int]).view
  <console>:8: error: value view is not a member of scala.collection.GenSeq[Int]
                (List(1): collection.GenSeq[Int]).view
                                                  ^
Let's keep it that way.

I suspect that views over parallel collections exist not because
they were the most sought after feature, but rather because the
initial incarnatin of parallel collections used to live undernead
TraversableOnce, and hence were obligated to implement `def view`.

This change will give us deprecation warnings in the non deprecated
places that extend `Gen*View` (three, by my count) in the interim.
There are ways to avoid this, but they aren't particularly appealing.
  • Loading branch information
retronym committed Nov 24, 2013
1 parent c243435 commit 2ce7b12
Show file tree
Hide file tree
Showing 12 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/library/scala/collection/GenIterableView.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
package scala
package collection

@deprecated("views over parallel collections will be removed", "2.11.0")
trait GenIterableView[+A, +Coll] extends GenIterableViewLike[A, Coll, GenIterableView[A, Coll]] { }
1 change: 1 addition & 0 deletions src/library/scala/collection/GenIterableViewLike.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
package scala
package collection

@deprecated("views over parallel collections will be removed", "2.11.0")
trait GenIterableViewLike[+A,
+Coll,
+This <: GenIterableView[A, Coll] with GenIterableViewLike[A, Coll, This]]
Expand Down
1 change: 1 addition & 0 deletions src/library/scala/collection/GenSeqView.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
package scala
package collection

@deprecated("views over parallel collections will be removed", "2.11.0")
trait GenSeqView[+A, +Coll] extends GenSeqViewLike[A, Coll, GenSeqView[A, Coll]] { }
2 changes: 1 addition & 1 deletion src/library/scala/collection/GenSeqViewLike.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ package collection




@deprecated("views over parallel collections will be removed", "2.11.0")
trait GenSeqViewLike[+A,
+Coll,
+This <: GenSeqView[A, Coll] with GenSeqViewLike[A, Coll, This]]
Expand Down
1 change: 1 addition & 0 deletions src/library/scala/collection/GenTraversableView.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
package scala
package collection

@deprecated("views over parallel collections will be removed", "2.11.0")
trait GenTraversableView[+A, +Coll] extends GenTraversableViewLike[A, Coll, GenTraversableView[A, Coll]] { }
1 change: 1 addition & 0 deletions src/library/scala/collection/GenTraversableViewLike.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ package collection
import generic._
import mutable.{ Builder, ArrayBuffer }

@deprecated("views over parallel collections will be removed", "2.11.0")
trait GenTraversableViewLike[+A,
+Coll,
+This <: GenTraversableView[A, Coll] with GenTraversableViewLike[A, Coll, This]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -841,6 +841,7 @@ self: ParIterableLike[T, Repr, Sequential] =>
tasksupport.executeAndWaitResult(new ToParMap(combinerFactory(cbf), splitter)(ev) mapResult { _.resultWithTaskSupport })
}

@deprecated("views over parallel collections will be removed", "2.11.0")
def view = new ParIterableView[T, Repr, Sequential] {
protected lazy val underlying = self.repr
protected[this] def viewIdentifier = ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import scala.collection.generic.CanCombineFrom
*
* @since 2.9
*/
@deprecated("views over parallel collections will be removed", "2.11.0")
trait ParIterableView[+T, +Coll <: Parallel, +CollSeq]
extends ParIterableViewLike[T, Coll, CollSeq, ParIterableView[T, Coll, CollSeq], IterableView[T, CollSeq]]
with GenIterableView[T, Coll]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import scala.language.implicitConversions
*
* @since 2.9
*/
@deprecated("views over parallel collections will be removed", "2.11.0")
trait ParIterableViewLike[+T,
+Coll <: Parallel,
+CollSeq,
Expand Down
1 change: 1 addition & 0 deletions src/library/scala/collection/parallel/ParSeqLike.scala
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ self =>

override def toSeq = this.asInstanceOf[ParSeq[T]]

@deprecated("views over parallel collections will be removed", "2.11.0")
override def view = new ParSeqView[T, Repr, Sequential] {
protected lazy val underlying = self.repr
protected[this] def viewIdentifier = ""
Expand Down
2 changes: 2 additions & 0 deletions src/library/scala/collection/parallel/ParSeqView.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ import scala.collection.generic.CanCombineFrom
*
* @since 2.9
*/
@deprecated("views over parallel collections will be removed", "2.11.0")
trait ParSeqView[+T, +Coll <: Parallel, +CollSeq]
extends ParSeqViewLike[T, Coll, CollSeq, ParSeqView[T, Coll, CollSeq], SeqView[T, CollSeq]]


@deprecated("views over parallel collections will be removed", "2.11.0")
object ParSeqView {
abstract class NoCombiner[T] extends Combiner[T, Nothing] {
// self: EnvironmentPassingCombiner[T, Nothing] =>
Expand Down
1 change: 1 addition & 0 deletions src/library/scala/collection/parallel/ParSeqViewLike.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import scala.collection.parallel.immutable.ParRange
*
* @since 2.9
*/
@deprecated("views over parallel collections will be removed", "2.11.0")
trait ParSeqViewLike[+T,
+Coll <: Parallel,
+CollSeq,
Expand Down

0 comments on commit 2ce7b12

Please sign in to comment.