<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">(Just catching up on this thread)<div class=""><br class=""></div><div class="">I’m actually still a little uncomfortable with this new translation of the Obj-C API, although maybe like you I just need to let my brain chew on it for a while. :)</div><div class=""><br class=""></div><div class="">Part of the issue I think is the original function name. As a query function, if I was rewriting this in Swift, I feel like I’d write it as something like “fetchAccount”. accountWith isn’t ideal, but it implies there is some sort of lookup mechanism that is going to happen, and it implies some sort of expense. Just “account” by itself becomes fuzzier than I’d like.</div><div class=""><br class=""></div><div class="">I think there are definitely cases where the with is unnecessary. Looking through Metal under Swift 3 tonight I found…</div><div class="">func newTextureWith(descriptor: MTLTextureDescriptor, offset: Int, bytesPerRow: Int) -> MTLTexture</div><div class=""><br class=""></div><div class="">Totally unnecessary here. I have all the context with “newTexture” that I need. I have a reasonable idea of what the function is doing.</div><div class=""><br class=""></div><div class="">If I was doing lookup, similarly I don’t know if I’d like this function name:</div><div class="">func texture(descriptor: MTLTextureDescriptor) -> MTLTexture</div><div class=""><br class=""></div><div class="">Especially in this context (in a scenario where maybe newTexture didn’t exist or someone is lost with the API), without more context, it sounds like this function might be used for texture creation. Although I admit “textureWith” wouldn’t be a huge improvement in that respect, but it does seem like a small improvement. Or maybe I just need to think about that one for a bit.</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 28, 2016, at 12:03 PM, Jordan Rose 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=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Y'know, I was going to complain about this too, and wrote up an example, complete with call site…</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class="">accountStore.account(currentID)</div></blockquote><div class=""><br class=""></div><div class="">…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 class=""><br class=""></div><div class="">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 class="">worse</i>, now that the base name isn't assumed to include the first argument.</div><div class=""><br class=""></div><div class="">Jordan</div><div class=""><br class=""></div><br class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jan 28, 2016, at 0:51, David Hart 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=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div dir="auto" class=""><div class="">Loss of 'with' sounds weird in certain cases:</div><div class=""><br class=""></div><div class=""><pre style="word-wrap: break-word;" class=""><font face="UICTFontTextStyleBody" class=""><span style="white-space: normal; background-color: rgba(255, 255, 255, 0);" class="">- func account(identifier identifier: String!) -> ACAccount!</span></font></pre><pre style="word-wrap: break-word;" class=""><span style="white-space: normal; background-color: rgba(255, 255, 255, 0); font-family: UICTFontTextStyleBody;" class="">+ func account(identifier: String!) -> ACAccount!</span></pre><br class="">Sent from my iPhone</div><div class=""><br class="">On 28 Jan 2016, at 00:31, Douglas Gregor via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><br class=""><div class=""><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" class=""><div class=""><id-identifier-name-match-string.patch></div></blockquote><blockquote type="cite" class=""><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><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" class=""><div class=""><id-identifier-name-no-first-arg-label.patch></div></blockquote><blockquote type="cite" class=""><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><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" class=""><div class=""><span class="">_______________________________________________</span><br class=""><span class="">swift-evolution mailing list</span><br class=""><span class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a></span><br class=""><span class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br class=""></div></blockquote></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class=""></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></div></body></html>