It's not a real bug, but I'd call it "unexpected behavior" — and I guess it will be changed sooner or later.
In the meantime: When you include the extension method in the protocol, everything should be fine.
and this method is printing Good, because it has a argument. (Default
Parameter Value - John - is not triggered)
More about it:
* video "Protocol-Oriented Programming in Swift" (WWDC 2015 - Session 408)
* Swift Book, section Function, subsection Default Parameter Values
Greg
···
2016-01-16 12:51 GMT+00:00 肇鑫 via swift-evolution <swift-evolution@swift.org>:
I got this by discussions in another thread of swift-evolution. The result
is interesting. I don't know if it should be treat as a bug.
Isn’t is just because “equivalent modulo default parameters” ranks lower in overload resolution? That may or may not be on purpose or desired, I don’t really know. As long as it’s documented, I guess.
-Sune
···
On 16 Jan 2016, at 16:06, Tino Heth via swift-evolution <swift-evolution@swift.org> wrote:
is that right or is it a bug?
It's not a real bug, but I'd call it "unexpected behavior" — and I guess it will be changed sooner or later.
In the meantime: When you include the extension method in the protocol, everything should be fine.