[swift-evolution] Name disambiguation of computed property/function with same type defined in extensions
Paulo Faria
paulo at zewo.io
Wed Jun 8 14:50:53 CDT 2016
I’m thinking I’ll just go ahead and create a formal proposal with this:
Given
ModuleA
extension String {
public func module() -> String {
return "ModuleA"
}
}
ModuleB
extension String {
public func module() -> String {
return "ModuleB"
}
}
Problem
ModuleC
import ModuleA
import ModuleB
let module = "hello swift”.module() // ambiguous
Proposal
ModuleC
import ModuleA
import ModuleB
let moduleA = ("hello swift”.module() from ModuleA)
print(moduleA) // prints "ModuleA"
let moduleB = ("hello swift”.module() from ModuleB)
print(moduleB) // prints "ModuleB"
let chainingExample = ("hello swift”.module() from ModuleB).uppercased()
print(chainingExample) // prints "MODULEB"
More information about the swift-evolution
mailing list