on Thu Apr 14 2016, Chris Lattner <swift-evolution@swift.org> wrote:
> We currently accept function type syntax without parentheses, like: > > Int -> Float > String -> () > > etc. The original rationale aligned with the fact that we wanted to > treat all functions as taking a single parameter (which was often of > tuple type) and producing a tuple value (which was sometimes a tuple, > in the case of void and multiple return values). However, we’ve long > since moved on from that early design point: there are a number of > things that you can only do in a parameter list now (varargs, default > args, etc), implicit tuple splat has been removed, and the compiler > has long ago stopped modeling function parameters this way. Beyond > that, it eliminates one potential style war. > > Given all this, I think it makes sense to go for syntactic uniformity > between parameter list and function types, and just require > parenthesis on the argument list. The types above can be trivially > written as: > > (Int) -> Float > (String) -> () > > Thoughts? +1, as I've always said. By everyone but the purely-functional-programming crowd, ()s are associated with functions; it makes sense to see them in the type, and the non-uniformity created by seeing A->B in the places it's allowed is not balanced by a widespread drop in syntactic noise. -- Dave _______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution