[swift-evolution] [Pre-proposal] Fix function type grammar

Vladimir.S svabox at gmail.com
Sun Jul 3 14:17:54 CDT 2016


On 03.07.2016 19:04, Anton Zhilin via swift-evolution wrote:
> Chris Lattner via swift-evolution <swift-evolution at ...> writes:
>
>> Hi Anton,
>>
>> This looks correct, but what is the proposal “for”?  This seems like it
> is just encoding what SE-0066 was about.
>>
>> -Chris
>
> Questions about that proposal are often risen on the list.
> Some think that we will still be able to supply () argument
> to () -> T functions.
>
> To clear that up completely, I suggest adding this grammar change
> to SE-0066 or one of the newer proposals. Key idea is that parentheses
> are part of function type grammar and have nothing common with tuples
> or unit type.

OK.. could you clarify, so, after the changes, we will not be able to pass 
`func f()->()` as parameter where parameter of type `typealias MyFunc<T> = 
(T) -> Void` is expected, right?

And what about the result type? What does `-> ()` now will mean? still 
"implicitly returns Void" or "returns nothing"? Or in case you want to 
return Void you'll need to write `-> Void` ?

And most likely I'm missing something, but I don't see where SE-0066 
mentions this aspect (disallow implicit Void argument in function which is 
defined as '()->()'), as I understand it is only about requirement of 
parentheses in declaration like Int->Int. Could you point me please?

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


More information about the swift-evolution mailing list