In the first place, I looked for a way to simplify coding by providing default argument values for protocol functions. I took the solution here and then found some fatal subsequence it may bring:
protocol Foo {
func foo(_ a: Int)
}
extension Foo {
func foo(_ a: Int = 4) {
foo(a)
}
}
struct FooImpl: Foo {
// empty implementation
}
FooImpl().foo() // will go recursively forever and finally reach the stack limit
I also found that this code would fail to compile in IBM Swift Sandbox thus supposing xcode compiler might be to blame.