[swift-evolution] named parameters - why hidden first?/proposal interest

Charles Srstka cocoadev at charlessoft.com
Sat Jan 23 01:13:34 CST 2016


> On Jan 21, 2016, at 1:25 PM, Tony Parker via swift-evolution <swift-evolution at swift.org> wrote:
> 
> We surveyed the entire surface area of the iOS and OS X SDKs, looking to see how many arguments typical methods had. We found that the vast majority of methods actually have just one argument. If we went with a rule that first arguments should be named, then methods like:
> 
> sayMessage(“hello”)
> 
> would be this instead:
> 
> say(message: “hello”)
> 
> which isn’t really much of an improvement, in my mind.

How about making it so that methods with just one argument have no label on the argument by default, but methods with two or more arguments have labels on all arguments? This would prevent what you describe above, while eliminating the ugliness of one parameter being treated differently from all the rest in the same method.

Charles

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160123/c3d18ed5/attachment.html>


More information about the swift-evolution mailing list