+1, but this proposal need further work.
Specification of the new function grammar is needed.

Currently, it looks like:

function-type → type
<https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Types.html#//apple_ref/swift/grammar/type>
­throws­opt­->­type
<https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Types.html#//apple_ref/swift/grammar/type>

It is already false, because some attributes can only be used in function
types.

I suggest to rewrite it to something like:

*function-type* → ( *function-parameter-types*opt ) -> *type*

*function-type* → ( *function-parameter-types*opt ) throws -> *type*

*function-type* → ( *function-parameter-types*opt ) rethrows -> *type*

*function-parameter-types* → *function-parameter-type*

*function-parameter-types* → *function-parameter-type* ,
*function-parameter-types*

*function-parameter-type* → *function-parameter-attributes* *type*
It will also eliminate situation when you can pass () argument to a () → T
function.
Function types Void->T will need to be migrated.

- Anton
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to