Vladimir, I agree with Chris Lattner that function parameters are different from function return value in Swift.
Firstly, syntax of function call allows for easy forwarding of values, which came from different places, as parameters to a single function: f(g(foo, 1), h(bar(buz))) On the other hand, to play with multiple return values as freely, you need to perform pattern matching, which finishes current expression. Secondly, there is no special sugar for tuples in return values, and function grammar does not need to know about it. Thirdly, there are no special attributes for elements of tuple in function return type (second implies this). Now, to typealias f4 = () -> ((((((())))))) I think it's OK, but we can remove Void and reduce the number of possible combinations. The fact that () and (()) are equal types is a general limitation of Swift type system: there are no single-element tuples. But it is so for a reason: parentheses in expressions cannot be overloaded to construct single-element tuples. - Anton 2016-04-22 11:12 GMT+03:00 Антон Жилин <antonyzhi...@gmail.com>: > +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> > throwsopt->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 swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution