[swift-evolution] [Proposal draft] Conditional conformances
Anton Zhilin
antonyzhilin at gmail.com
Wed Sep 28 04:55:48 CDT 2016
I find the limitation of non-intersection of conditional conformance
reqirements quite limiting. Can it be lifted in case there are no
overloaded functions between extensions?
protocol A { func foo() }
protocol B { func bar() }
extension Array: A where Element: A {
func foo() { return self.first!.foo() }
}
extension Array: B where Element: B {
func bar() { return self.first!.bar() }
}
let arr: Array<T>
arr.foo()
What is ambiguous here? When we see arr.foo(), we know it's from Array: A
extension, regardless of T, and we just have to check the requirement of
that extension.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160928/584d3aee/attachment.html>
More information about the swift-evolution
mailing list