<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Loss of 'with' sounds weird in certain cases:</div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature"><pre style="word-wrap: break-word;"><font face="UICTFontTextStyleBody"><span style="white-space: normal; background-color: rgba(255, 255, 255, 0);">- func account(identifier identifier: String!) -> ACAccount!</span></font></pre><pre style="word-wrap: break-word;"><span style="white-space: normal; background-color: rgba(255, 255, 255, 0); font-family: UICTFontTextStyleBody;">+ func account(identifier: String!) -> ACAccount!</span></pre><br>Sent from my iPhone</div><div><br>On 28 Jan 2016, at 00:31, Douglas Gregor via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=utf-8"><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 27, 2016, at 10:03 AM, Dave Abrahams via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">on Wed Jan 27 2016, Matthew Johnson <</span><a href="mailto:swift-evolution@swift.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">swift-evolution@swift.org</a><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">> wrote:</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">Doug,<br class=""><br class="">I think this change looks great! I don’t have time to look through<br class="">the full patch but did look through quite a bit. It adds clarity in<br class="">the vast majority of cases I looked at.<br class=""><br class="">It seems like with-as-separator is a good heuristic for determining<br class="">when the first parameter is not essential to a good name for the<br class="">fundamental operation. I agree with the comments earlier on that in<br class="">these cases a label for the first parameter is the best approach.<br class=""><br class="">I also really like that this groups methods with the same fundamental<br class="">operation into overload families where they previously had independent<br class="">names. This is a big win IMO.<br class=""><br class="">There is a first-parameter-is-an-ID pattern I noticed after this<br class="">change. I show a few examples here, but there are a lot more:<br class=""><br class="">- func trackWithTrackID(trackID: CMPersistentTrackID) -> AVAssetTrack?<br class="">+ func track(trackID trackID: CMPersistentTrackID) -> AVAssetTrack?<br class=""><br class="">- func trackWithTrackID(trackID: CMPersistentTrackID) -> AVFragmentedAssetTrack?<br class="">+ func track(trackID trackID: CMPersistentTrackID) -> AVFragmentedAssetTrack?<br class=""><br class="">- func trackWithTrackID(trackID: CMPersistentTrackID) -> AVCompositionTrack?<br class="">+ func track(trackID trackID: CMPersistentTrackID) -> AVCompositionTrack?<br class=""><br class="">- func discoverUserInfoWithUserRecordID(userRecordID: CKRecordID,<br class="">completionHandler: (CKDiscoveredUserInfo?, Error?) -> Void)<br class=""><br class="">+ func discoverUserInfo(userRecordID userRecordID: CKRecordID,<br class="">completionHandler: (CKDiscoveredUserInfo?, Error?) -> Void)<br class=""><br class="">The first argument label `trackID` seems like it repeats type<br class="">information without adding clarity. I think it would be better to<br class="">just use `id` here. It seems like a candidate for heuristics as well.<br class="">For example, if the type name ends in ID and the label is a suffix of<br class="">the type name we could just use `id`. This is a somewhat specific<br class="">pattern, but IDs are common enough that it might make sense.<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Actually I've been saying for a while that arguments called ID,</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">identifier, and name should not be labelled at all in many cases. Think</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">about it.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote></div><div class=""><br class=""></div><div class="">Patch where the words “ID”, “Identifier”, and “Name” in a name are considered to match the type “String”:</div><div class=""><br class=""></div><div class=""></div></div></blockquote><blockquote type="cite"><div><id-identifier-name-match-string.patch></div></blockquote><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=utf-8"><div class=""></div><div class=""><br class=""></div><div class="">… and then extending the rule to zap first argument labels named “identifier”, “id”, or “name”:</div><div class=""><br class=""></div><div class=""></div></div></blockquote><blockquote type="cite"><div><id-identifier-name-no-first-arg-label.patch></div></blockquote><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=utf-8"><div class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">(I’m not sure which one of these you meant, or something different):</div><br class=""><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>- Doug</div><div class=""><br class=""></div></div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></body></html>