[swift-users] [swift-evolution] [Question] Types of functions
Vladimir.S
svabox at gmail.com
Thu Oct 6 13:38:49 CDT 2016
On 12.11.2016 11:38, Adrian Zubarev via swift-users wrote:
(Adrian, are you from the future? ;-)
> 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 |
>
IIUC, as soon as
SE-0110(https://github.com/apple/swift-evolution/blob/master/proposals/0110-distingish-single-tuple-arg.md)
was not marked as "implemented" yet according to
https://apple.github.io/swift-evolution/, we still have some rudiments of
older design.
I expect that implementation of SE-0110 will separate types
(Int, Int) -> ()
and
((Int, Int)) -> ()
Also implementation of SE-0110 should remove implicit Void parameter in
function defined with no parameters
func f() {}
func g() {}
f(g()) // now works, will be error
func foo(f: () -> ()) { f() }
foo {x in print(x)} // now works, will be error
I'd really like to know when this proposal will be implemented : in Swift
3.x or in 4.x
>
>
> --
> Adrian Zubarev
> Sent with Airmail
>
> Am 5. Oktober 2016 um 17:02:43, Anton Zhilin via swift-evolution
> (swift-evolution at swift.org <mailto:swift-evolution at swift.org>) schrieb:
>
>> print(type(of: [Int].append)) //=> (inout Array<Int>) -> (Int) -> ()
>> print(type(of: print)) //=> ((Array<Any>, String, String)) -> ()
>
>
>
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
>
More information about the swift-users
mailing list