Scala Map, ambiguity between tuple and function argument list -
val m = scala.collection.mutable.map[string, int]() // doesn't work m += ("foo", 2) // work m += (("foo", 2)) // works val barpair = ("bar", 3) m += barpair so what's deal m += ("foo" , 2) not working? scala gives type error:
error: type mismatch; found : java.lang.string("foo") required: (string, int) m += ("foo", 2) ^ apparently scala thinks trying call += 2 arguments, instead of 1 tuple argument. why? isn't unambiguous, since not using m.+= ?
unfortunately a b (c, d, e, ..) desugars a.b(c, d, e, ..). hence error.
Comments
Post a Comment