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

Shawn Erickson shawnce at gmail.com
Mon Mar 14 22:30:46 CDT 2016


On Mon, Mar 14, 2016 at 8:05 PM Jordan Rose <jordan_rose at apple.com> wrote:

> Ah, this doesn't distinguish
>
> func foo(bar baz: Int)
>
>
> from
>
> func foo(bar bar: Int)
>
>
> That's pretty important for this discussion.
>
> (Thanks for actually doing this! I just let it drop last week.)
>
> [shawnce:~/Downloads/swift-3-api-guidelines-review-swift-3]
[0:574]> grep -R "func [A-Za-z0-9]*(\([A-Za-z0-9]*\) \1:" Platforms/ | wc -l
     274

[shawnce:~/Downloads/swift-3-api-guidelines-review-swift-3]
[0:579]> grep -R "func [A-Za-z0-9]*(\([A-Za-z0-9]*\) \1:" Platforms/ | head
-5
Platforms//iOS/AssetsLibrary/ALAssetRepresentation.swift:  func
cgImage(options options: [NSObject : AnyObject]! = [:]) ->
Unmanaged<CGImage>!
Platforms//iOS/CloudKit/CKContainer.swift:  func
accountStatus(completionHandler completionHandler: (CKAccountStatus,
NSError?) -> Void)
Platforms//iOS/CloudKit/CKContainer.swift:  func
fetchUserRecordID(completionHandler completionHandler: (CKRecordID?,
NSError?) -> Void)
Platforms//iOS/CloudKit/CKContainer.swift:  func
discoverAllContactUserInfos(completionHandler completionHandler:
([CKDiscoveredUserInfo]?, NSError?) -> Void)
Platforms//iOS/CloudKit/CKDatabase.swift:  func
fetchAllRecordZones(completionHandler completionHandler: ([CKRecordZone]?,
NSError?) -> Void)


On Mar 14, 2016, at 16:01 , Shawn Erickson via swift-evolution <
> swift-evolution at swift.org> wrote:
>
> I could have easily screwed up my grep but doing spot checks on the
> resulting data sets I didn't spot an issue. I did make assumptions about
> how well formed the data set was.
>
> [shawnce:~/Downloads/swift-3-api-guidelines-review-swift-3]
> [0:554]> grep -R "func [A-Za-z0-9]*([A-Za-z0-9]* [A-Za-z0-9]*:" Platforms/
> | wc -l
>    10587
>
> [shawnce:~/Downloads/swift-3-api-guidelines-review-swift-3]
> [0:555]> grep -R "func [A-Za-z0-9]*(_ [A-Za-z0-9]*:" Platforms/ | wc -l
>    21654
>
> [shawnce:~/Downloads/swift-3-api-guidelines-review-swift-3]
> [0:556]> grep -R "func [A-Za-z0-9]*([A-Za-z0-9]* _:" Platforms/ | wc -l
>        0
>
> [shawnce:~/Downloads/swift-3-api-guidelines-review-swift-3]
> [0:557]> grep -R "func [A-Za-z0-9]*([A-Za-z0-9]*:" Platforms/ | wc -l
>       14
>
> [shawnce:~/Downloads/swift-3-api-guidelines-review-swift-3]
> [0:558]> grep -R "func [A-Za-z0-9]*()" Platforms/ | wc -l
>     7190
>
> ----
>
> [shawnce:~/Downloads/swift-3-api-guidelines-review-swift-3]
> [0:559]> grep -R "func [A-Za-z0-9]*([A-Za-z0-9]* [A-Za-z0-9]*:"
> SampleCode/ | wc -l
>       12
>
> [shawnce:~/Downloads/swift-3-api-guidelines-review-swift-3]
> [0:560]> grep -R "func [A-Za-z0-9]*(_ [A-Za-z0-9]*:" SampleCode/ | wc -l
>        0
>
> [shawnce:~/Downloads/swift-3-api-guidelines-review-swift-3]
> [0:561]> grep -R "func [A-Za-z0-9]*([A-Za-z0-9]* _:" SampleCode/ | wc -l
>        0
>
> [shawnce:~/Downloads/swift-3-api-guidelines-review-swift-3]
> [0:562]> grep -R "func [A-Za-z0-9]*([A-Za-z0-9]*:" SampleCode/ | wc -l
>      512
>
> [shawnce:~/Downloads/swift-3-api-guidelines-review-swift-3]
> [0:563]> grep -R "func [A-Za-z0-9]*()" SampleCode/ | wc -l
>      221
>
>
> On Mon, Mar 14, 2016 at 3:28 PM Dave Abrahams via swift-evolution <
> swift-evolution at swift.org> wrote:
>
>>
>> on Sun Mar 13 2016, Shawn Erickson <swift-evolution at swift.org> wrote:
>>
>> > On Fri, Mar 11, 2016 at 1:30 PM Dave Abrahams via swift-evolution <
>> > swift-evolution at swift.org> wrote:
>> >
>> >>
>> >> Anyone who wants to measure is free to do so: simple regexps and wc
>> >> generally work for this purpose.
>> >>
>> >>
>> >>
>> https://github.com/apple/swift-3-api-guidelines-review/tree/swift-3/Platforms
>> >>
>> >
>> > Not sure if anyone actually got around to this so doing a basic set of
>> > regex (includes class functions and overrides)...
>> >
>> > func foo(bar baz:Baz... ---> 10544
>> > func foo(baz:Baz... ---> 526
>> > func foo(_:Baz... ---> 92
>> > func foo() ---> 7392
>>
>> Are you certain?  Last we checked it was about 50/50 between having and
>> not-having a distinct argument label.
>>
>> --
>> -Dave
>>
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-evolution
>>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160315/e4fc09b0/attachment.html>


More information about the swift-evolution mailing list