Re: scaladoc is not uptodate with latest release?
Zemian Deng wrote:
> [...] I just found out that scala.collection.mutable.Map
> has deprecated method += that's not showing on scaladoc. [...]
Hello,
the method +=(key: A): MapTo that you refer to is documented and
correctly marked as deprecated in the released scaladoc.
> [...] I like the old deprecated method better than the new suggested way.
> Is there better reason for this change other than require more typing?
I think you are simply experiencing trouble with operator precedence and
ambiguity of parentheses here.
> val m = new HashMap[String, Int]
> m += "one"->111 // warning: [...]
Try
m += ("one" -> 111)
> m += Pair("two", 222) //the new way
> m += ("two", 222) // and this product error!
Try
m += (("one", 111))
> What is your take on the deprecated method?
I fully agree that having a method named += which doesn't add an element
to a collection but rather returns some strange object that is capable
of performing the addition via its method called -> is a bad idea and
rather counterintuitive. The new solution to take a Tuple2 as a
parameter and to have the implicit conversion from Any to ArrowAssoc is
much more to my taste.
cu,
Thomas