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. - Empty first argument label. - First argument label that does not match the parameter name. 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 > On Mar 14, 2016, at 20:30 , Shawn Erickson <[email protected]> wrote: > > > > On Mon, Mar 14, 2016 at 8:05 PM Jordan Rose <[email protected] > <mailto:[email protected]>> 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 >> <[email protected] <mailto:[email protected]>> 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 >> <[email protected] <mailto:[email protected]>> wrote: >> >> on Sun Mar 13 2016, Shawn Erickson <[email protected] >> <mailto:[email protected]>> wrote: >> >> > On Fri, Mar 11, 2016 at 1:30 PM Dave Abrahams via swift-evolution < >> > [email protected] <mailto:[email protected]>> 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 >> >> >> >> <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 >> [email protected] <mailto:[email protected]> >> https://lists.swift.org/mailman/listinfo/swift-evolution >> <https://lists.swift.org/mailman/listinfo/swift-evolution> >> _______________________________________________ >> swift-evolution mailing list >> [email protected] <mailto:[email protected]> >> https://lists.swift.org/mailman/listinfo/swift-evolution >> <https://lists.swift.org/mailman/listinfo/swift-evolution> >
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
