Swift: Rules for named arguments should be consistant

Originator:gordon
Number:rdar://17253311 Date Originated:10-Jun-2014 10:36 AM
Status:Open Resolved:
Product:Developer Tools Product Version:1
Classification:Enhancement Reproducible:Always
 
Summary:
Currently, the rules for when a function requires an argument to be named are needlessly complex. Global functions don’t require named arguments by default, local functions (scoped to a class or struct) only require that arguments after the first one are named, and constructors require all arguments to be named.

It seems like simplifying the rules to match the local function’s behavior of requiring the naming of all arguments after the first one would cut down on some of this confusion, and lead to a more consistent API design.

Steps to Reproduce:
Write the following functions:

```swift
func globalFunc(string: String, otherString: String) {
}

class Foo {
    func localFunc(string: String, otherString: String) {
    }
}
```

Expected Results:
Expect that the naming rules are consistent when calling the 2 functions

Actual Results:
The naming rules are inconsistent:

```swift
globalFunc("foo", "bar")

Foo().localFunc("foo", otherString: "bar")
```

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!