From 2ce7b1269aebcc83ee433f4114779e54ee43f9f3 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Sun, 24 Nov 2013 21:34:57 +0100 Subject: Deprecates Par*View and Gen*View 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 :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. --- src/library/scala/collection/GenIterableView.scala | 1 + src/library/scala/collection/GenIterableViewLike.scala | 1 + src/library/scala/collection/GenSeqView.scala | 1 + src/library/scala/collection/GenSeqViewLike.scala | 2 +- src/library/scala/collection/GenTraversableView.scala | 1 + src/library/scala/collection/GenTraversableViewLike.scala | 1 + src/library/scala/collection/parallel/ParIterableLike.scala | 1 + src/library/scala/collection/parallel/ParIterableView.scala | 1 + src/library/scala/collection/parallel/ParIterableViewLike.scala | 1 + src/library/scala/collection/parallel/ParSeqLike.scala | 1 + src/library/scala/collection/parallel/ParSeqView.scala | 2 ++ src/library/scala/collection/parallel/ParSeqViewLike.scala | 1 + 12 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/library/scala/collection/GenIterableView.scala b/src/library/scala/collection/GenIterableView.scala index cd052ddf79..d82649eee6 100644 --- a/src/library/scala/collection/GenIterableView.scala +++ b/src/library/scala/collection/GenIterableView.scala @@ -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]] { } diff --git a/src/library/scala/collection/GenIterableViewLike.scala b/src/library/scala/collection/GenIterableViewLike.scala index b519e99ae5..ed3e5ae3c4 100644 --- a/src/library/scala/collection/GenIterableViewLike.scala +++ b/src/library/scala/collection/GenIterableViewLike.scala @@ -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]] diff --git a/src/library/scala/collection/GenSeqView.scala b/src/library/scala/collection/GenSeqView.scala index 0a214832ad..283450640d 100644 --- a/src/library/scala/collection/GenSeqView.scala +++ b/src/library/scala/collection/GenSeqView.scala @@ -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]] { } diff --git a/src/library/scala/collection/GenSeqViewLike.scala b/src/library/scala/collection/GenSeqViewLike.scala index d3af953f72..d757871a3d 100644 --- a/src/library/scala/collection/GenSeqViewLike.scala +++ b/src/library/scala/collection/GenSeqViewLike.scala @@ -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]] diff --git a/src/library/scala/collection/GenTraversableView.scala b/src/library/scala/collection/GenTraversableView.scala index 7d9a6e9777..d62ff74084 100644 --- a/src/library/scala/collection/GenTraversableView.scala +++ b/src/library/scala/collection/GenTraversableView.scala @@ -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]] { } diff --git a/src/library/scala/collection/GenTraversableViewLike.scala b/src/library/scala/collection/GenTraversableViewLike.scala index dde18a7a32..b04c927634 100644 --- a/src/library/scala/collection/GenTraversableViewLike.scala +++ b/src/library/scala/collection/GenTraversableViewLike.scala @@ -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]] diff --git a/src/library/scala/collection/parallel/ParIterableLike.scala b/src/library/scala/collection/parallel/ParIterableLike.scala index 5ec0238c69..bbe8fce737 100644 --- a/src/library/scala/collection/parallel/ParIterableLike.scala +++ b/src/library/scala/collection/parallel/ParIterableLike.scala @@ -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 = "" diff --git a/src/library/scala/collection/parallel/ParIterableView.scala b/src/library/scala/collection/parallel/ParIterableView.scala index 6dce19db19..3b0b0013fd 100644 --- a/src/library/scala/collection/parallel/ParIterableView.scala +++ b/src/library/scala/collection/parallel/ParIterableView.scala @@ -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] diff --git a/src/library/scala/collection/parallel/ParIterableViewLike.scala b/src/library/scala/collection/parallel/ParIterableViewLike.scala index 5a7a5f5601..02bed6dd80 100644 --- a/src/library/scala/collection/parallel/ParIterableViewLike.scala +++ b/src/library/scala/collection/parallel/ParIterableViewLike.scala @@ -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, diff --git a/src/library/scala/collection/parallel/ParSeqLike.scala b/src/library/scala/collection/parallel/ParSeqLike.scala index 6693e30fcd..33deb84a6f 100644 --- a/src/library/scala/collection/parallel/ParSeqLike.scala +++ b/src/library/scala/collection/parallel/ParSeqLike.scala @@ -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 = "" diff --git a/src/library/scala/collection/parallel/ParSeqView.scala b/src/library/scala/collection/parallel/ParSeqView.scala index b80994514b..5cebfb44f9 100644 --- a/src/library/scala/collection/parallel/ParSeqView.scala +++ b/src/library/scala/collection/parallel/ParSeqView.scala @@ -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] => diff --git a/src/library/scala/collection/parallel/ParSeqViewLike.scala b/src/library/scala/collection/parallel/ParSeqViewLike.scala index 9d30a052de..a348bcf586 100644 --- a/src/library/scala/collection/parallel/ParSeqViewLike.scala +++ b/src/library/scala/collection/parallel/ParSeqViewLike.scala @@ -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, -- cgit v1.2.3