[swift-evolution] [Question] Types of functions

Anton Zhilin antonyzhilin at gmail.com
Wed Oct 5 10:00:39 CDT 2016


// Swift 2.2print([Int].append.dynamicType)  //=> inout Array<Int> ->
Int -> ()print(print.dynamicType)  //=> (Array<protocol<>>, String,
String) -> ()
// Swift 3print(type(of: [Int].append))  //=> (inout Array<Int>) ->
(Int) -> ()print(type(of: print))  //=> ((Array<Any>, String, String))
-> ()

Question #1: Methods are still curried. If I’m not mistaken, there was an
accepted proposal that uncurries methods. Is it going to be implemented for
Swift 4 Stage 1?

Question #2: Why nested tuple in type of print? Is it just a formatter bug,
or… do functions still take tuples under the hood? If so, then perhaps,
implementation needs to be modified to actually use new model, and not just
make it look like it does.
​
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20161005/5e99357e/attachment.html>


More information about the swift-evolution mailing list