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"
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to