<div dir="ltr">"account" is also a verb. It's not easy to confuse in this situation, but I fear other verb/noun ambiguities might be more confusing; the preposition helps.<div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div>Jacob<br></div></div></div></div>
<br><div class="gmail_quote">On Thu, Jan 28, 2016 at 12:03 PM, Jordan Rose via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>Y'know, I was going to complain about this too, and wrote up an example, complete with call site…</div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>accountStore.account(currentID)</div></blockquote><div><br></div><div>…and then realized that it didn't bother me as much as I thought. "account" is a noun, so this is either getting or creating an account for me (as if it were a property), and it's going to use "currentID" to do it.</div><div><br></div><div>I'm very used to "fooWithBar: baz" meaning either "get me the foo that has a bar matching baz" or "create me a foo with its bar set to baz". But I'm not sure this new convention is any <i>worse</i>, now that the base name isn't assumed to include the first argument.</div><div><br></div><div>Jordan</div><div><div class="h5"><div><br></div><br><br><div><blockquote type="cite"><div>On Jan 28, 2016, at 0:51, David Hart via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:</div><br><div><div dir="auto"><div>Loss of 'with' sounds weird in certain cases:</div><div><br></div><div><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" target="_blank">swift-evolution@swift.org</a>> wrote:<br><br></div><blockquote type="cite"><div><br><div><blockquote type="cite"><div>On Jan 27, 2016, at 10:03 AM, Dave Abrahams via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:</div><br><div><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">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;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">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;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">> wrote:</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><blockquote type="cite" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">Doug,<br><br>I think this change looks great! I don’t have time to look through<br>the full patch but did look through quite a bit. It adds clarity in<br>the vast majority of cases I looked at.<br><br>It seems like with-as-separator is a good heuristic for determining<br>when the first parameter is not essential to a good name for the<br>fundamental operation. I agree with the comments earlier on that in<br>these cases a label for the first parameter is the best approach.<br><br>I also really like that this groups methods with the same fundamental<br>operation into overload families where they previously had independent<br>names. This is a big win IMO.<br><br>There is a first-parameter-is-an-ID pattern I noticed after this<br>change. I show a few examples here, but there are a lot more:<br><br>- func trackWithTrackID(trackID: CMPersistentTrackID) -> AVAssetTrack?<br>+ func track(trackID trackID: CMPersistentTrackID) -> AVAssetTrack?<br><br>- func trackWithTrackID(trackID: CMPersistentTrackID) -> AVFragmentedAssetTrack?<br>+ func track(trackID trackID: CMPersistentTrackID) -> AVFragmentedAssetTrack?<br><br>- func trackWithTrackID(trackID: CMPersistentTrackID) -> AVCompositionTrack?<br>+ func track(trackID trackID: CMPersistentTrackID) -> AVCompositionTrack?<br><br>- func discoverUserInfoWithUserRecordID(userRecordID: CKRecordID,<br>completionHandler: (CKDiscoveredUserInfo?, Error?) -> Void)<br><br>+ func discoverUserInfo(userRecordID userRecordID: CKRecordID,<br>completionHandler: (CKDiscoveredUserInfo?, Error?) -> Void)<br><br>The first argument label `trackID` seems like it repeats type<br>information without adding clarity. I think it would be better to<br>just use `id` here. It seems like a candidate for heuristics as well.<br>For example, if the type name ends in ID and the label is a suffix of<br>the type name we could just use `id`. This is a somewhat specific<br>pattern, but IDs are common enough that it might make sense.<br></blockquote><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">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;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">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;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">about it.</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"></div></blockquote></div><div><br></div><div>Patch where the words “ID”, “Identifier”, and “Name” in a name are considered to match the type “String”:</div><div><br></div><div></div></div></blockquote><blockquote type="cite"><div><id-identifier-name-match-string.patch></div></blockquote><blockquote type="cite"><div><div></div><div><br></div><div>… and then extending the rule to zap first argument labels named “identifier”, “id”, or “name”:</div><div><br></div><div></div></div></blockquote><blockquote type="cite"><div><id-identifier-name-no-first-arg-label.patch></div></blockquote><blockquote type="cite"><div><div></div><div><br></div><div><br></div><div>(I’m not sure which one of these you meant, or something different):</div><br><div><br></div><div><span style="white-space:pre-wrap">        </span>- Doug</div><div><br></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" target="_blank">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></div>_______________________________________________<br>swift-evolution mailing list<br><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></div></blockquote></div><br></div></div></div><br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div></div>