[swift-evolution] [Pitch] Make the first parameter in a function declaration follow the same rules as the others
brent at architechies.com
Wed Mar 9 15:07:20 CST 2016
> Our accepted naming guidelines have embraced first argument labels for functions and methods. This weakens our justification for making the first parameter declaration in a `func` declaration behave differently from the others, implicitly being unlabeled. It seems pretty clear to me we should make all of the parameter declarations behave uniformly:
> func foo(x: Int, y: Int) // Should declare foo(x:y:), instead of foo(_:y:)
> func foo(_ x: Int, y: Int) // Explicitly declares foo(_:y:)
> This would also make `init` and `func` parameters behave consistently, which is nice. There may still be hope for our keyword argument rules to one day be shorter than the Smalltalk spec…
+1. (This was actually in my mental list of things to propose.)
I believe this leaves only subscripts with a rule that doesn't label all parameters. Subscripts (or at least unary subscripts) *should* usually have unlabeled parameters, but having a single rule might be worth requiring `_` in those.
I also think there's a good case for bringing back something like the old `#foo`, but that's a separable issue.
More information about the swift-evolution