[swift-users] [swift-evolution] [Question] Types of functions

Adrian Zubarev adrian.zubarev at devandartist.com
Thu Oct 6 02:39:18 CDT 2016


We should move this thread to swift-users.

Here is something that I just tried:

func foo(_: Int, _: Int) {}
func boo(_: (Int, Int)) {}
type(of: foo) == type(of: boo) //=> true ; (((Int, Int)) -> ()).Type

let tuple = (0, 42)
foo(tuple) // Tuple splat was removed => Error
boo(tuple) // Expected => Okay


-- 
Adrian Zubarev
Sent with Airmail

Am 5. Oktober 2016 um 17:02:43, Anton Zhilin via swift-evolution (swift-evolution at swift.org) schrieb:

print(type(of: [Int].append))  //=> (inout Array<Int>) -> (Int) -> ()
print(type(of: print))  //=> ((Array<Any>, String, String)) -> ()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20161006/40442c07/attachment.html>


More information about the swift-users mailing list