You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
scala>vals1=Set[Any](1, 2, 3)
s1: scala.collection.immutable.Set[Any] =Set(1, 2, 3)
scala>vals2=Set[Any]("a", "b")
s2: scala.collection.immutable.Set[Any] =Set(a, b)
scala> s1 ++ s2
<console>:8:error: ambiguous reference to overloaded definition,
both method ++ in traitAddable of type (xs: scala.collection.TraversableOnce[Any])scala.collection.immutable.Set[Any]
and method ++ in traitTraversableLike of type [B>:Any,That](that: scala.collection.TraversableOnce[B])(implicitbf: scala.collection.generic.CanBuildFrom[scala.collection.immutable.Set[Any],B,That])Thatmatch argument types (scala.collection.immutable.Set[Any])
s1 ++ s2
^
I can make this easy. We delete Addable and AddingBuilder. It took me about five seconds, and afterward:
Here is the sad tale of Addable. First off the boat was Map.
-// note: can't inherit Addable because of variance problems: Map-// is covariant in its value type B, but Addable is nonvariant.
We had to suffer longer and more confusingly, but in the end Seq also took its leave:
-// Note this does not extend Addable because `+` is being phased out of-// all Seq-derived classes.
Of course GrowingBuilder has to get its two cents in:
/** The canonical builder for collections that are growable, i.e. that support an * efficient `+=` method which adds an element to the collection. It is * almost identical to `AddingBuilder`, but necessitated by the existence of * classes which are `Growable` but not `Addable`, which is a result of covariance * interacting surprisingly with any2stringadd thus driving '+' out of the `Seq` * hierarchy. The tendrils of original sin should never be underestimated. * * Addendum: of even greater significance is that '+' on mutable collections now * creates a new collection. This means using AddingBuilder on them will create * a new intermediate collection for every element given to the builder, taking * '+' from an O(1) to O(n) operation.
And then there was only Set, standing alone as the only Addable collection
and the only customer for AddingBuilder. Which means that "Addable" can as
easily be folded into SetLike, and "AddingBuilder" into SetBuilder, and nothing
is lost except another overload trap.
It's all done: for the low price of a single thumb in the upward direction I can drive nails into both coffins.
The text was updated successfully, but these errors were encountered:
@paulp said:
(In r23707) Extricated Addable and AddingBuilder from the few classes still
utilizing them and deprecated both. Closes #4059. Already endorsed
by odersky, so no review.
Reported elsewhere:
I can make this easy. We delete Addable and AddingBuilder. It took me about five seconds, and afterward:
Here is the sad tale of Addable. First off the boat was Map.
We had to suffer longer and more confusingly, but in the end Seq also took its leave:
Of course GrowingBuilder has to get its two cents in:
And then there was only Set, standing alone as the only Addable collection
and the only customer for AddingBuilder. Which means that "Addable" can as
easily be folded into SetLike, and "AddingBuilder" into SetBuilder, and nothing
is lost except another overload trap.
It's all done: for the low price of a single thumb in the upward direction I can drive nails into both coffins.
The text was updated successfully, but these errors were encountered: