[swift-evolution] [Pitch] Make the first parameter in a function declaration follow the same rules as the others

Erica Sadun erica at ericasadun.com
Tue Mar 15 12:04:59 CDT 2016


> On Mar 15, 2016, at 10:41 AM, Jordan Rose via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Thank you! I realized one other potential flaw in the data-gathering: your search for "func foo(_ bar" will match both Objective-C methods and C functions. I'm not sure CF should really be contributing to the scores. Unfortunately the main way I can think of to differentiate them is by indentation, which seems a little sketchy.
> 
> Still, the conclusions I would draw from this are that the vast majority of methods fall into one of the three following categories:
> 
> - No arguments.

No harm, no foul situation.

> - Empty first argument label.

Change would primarily affect adding "_ ", two characters

> - First argument label that does not match the parameter name.

No harm, no foul situation.

I still feel that adding consistency outweighs the inconvenience of the two extra characters, 
which then show an *intent* that the argument label is empty by choice rather than convention.

-- E

> This doesn't mean we shouldn't change the convention—"_ completionHandler" is much easier to type than "completionHandler completionHandler", and it's still removing complexity—but it does mean (to me) that the new API naming guidelines don't make the "matching" case more important; they only make the "no label" case less important.
> 
> Jordan

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


More information about the swift-evolution mailing list