sjavora
(Šimon Javora)
1
Why does the following code compile? I'd expect it to complain about ambiguous use of 'x', but that only happens when both methods have the same number of parameters, all with default values 
struct Foo {
func x(a: Int = 0, b: Int = 0) {
}
func x(b: Int = 0) {
}
}
Foo().x()
1 Like
Martin
(Martin R)
2
What I assume is that the compiler considers func x(b: Int = 0) to be the “more specific” method matching the call, and therefore chooses it. I am sure that someone can give a more authoritative answer ...
2 Likes
sjavora
(Šimon Javora)
3
I suspect you’re right. This behavior is not documented anywhere is it? I too would love an authoritative answer...