So Swift 3 removed implicit tuple splat behavior. See here
So this would work pre-Swift 3 but now it no longer works:
func foo(x:Int, y:Int, z:Int) { }
let bar = (1, 2, 3)
foo(bar)
Meaning you can no longer pass a single tuple and have it automatically distribute into multiple parameters.
What I'm confused about is why does this work?
func call<I, O>(function: (I) -> O, params: I) -> O { return function(params)}
func sum(x:Int, y:Int, z:Int) -> Int {
return x + y + z
}
let x = (1, 2, 3)
call(function: sum, params: x) //returns sum(x) which returns 6
Why does call(function: sum, params: x) compile but when I call sum(x) directly it doesn't compile?
Does Swift only ban implicit tuple splat behavior (but not explicit). Does Swift consider call(function: sum, params: x) to be explicit tuple splat? If so what is the difference between implicit and explicit here?
