Which would be source-breaking, yes.
Given this function:
func f() {
let dict: [Int: (Int, Double)] = [
1: (2, 3.0)
]
let dict2 = dict.mapValues { x, y in
return String(describing: y)
}
print(dict2)
}
The output today is:
[1: "3.0"]
With this overload added, the output will silently change to:
[1: "(2, 3.0)"]
This specific example is contrived, obviously, but the point is that there would be a source-breaking change. The obvious solution is to just pick a different name such as mapValuesForKeys(_:). ![]()