Le 27 déc. 2015 à 19:54, Wallacy via swift-evolution 
<swift-evolution@swift.org> a écrit :
> Even with backticks would not be possible.
> 
> You may need to reference the method signature altogether.
> 
> var someA = A()
> let fn1 = someA.#someFunc(a: Int) -> Int
> let fn2 = someA.#someFunc(a: Int) -> Double 
> let fn3 = someA.#someFunc(a: Double) -> Int 
> let fn4 = someA.#someFunc(a: Double) -> Double
> 
> An operator at the beginning perhaps?
> 
> let fn1 = #someA.someFunc(a: Int) -> Int
> let fn2 = #someA.someFunc(a: Int) -> Double
> let fn3 = #someA.someFunc(a: Double) -> Int
> let fn4 = #someA.someFunc(a: Double) -> Double

Well, this works today:

let fn1: Int -> Int = someA.someFunc
let fn2: Int -> Double = someA.someFunc
let fn3: Double -> Int = someA.someFunc
let fn4: Double -> Double = someA.someFunc

In fact, this too works:

let fn1: (a: Int) -> Int = someA.someFunc
let fn2: (a: Int) -> Double = someA.someFunc
let fn3: (a: Double) -> Int = someA.someFunc
let fn4: (a: Double) -> Double = someA.someFunc

See the parameter name in the type? It could be used to disambiguate, but 
currently it is not taken into account: if you add a `someFunc` overload taking 
a different parameter name but the same types the above code becomes ambiguous.

-- 
Michel Fortin
https://michelf.ca

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to