<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=""><div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Ah, interesting!</div><div class=""><br class=""></div><div class="">I definitely see the rationale for this. Calling a method like `tracks` seems a bit confusing, it doesn’t capture the intent at all. The ObjC-convention version, say, `tracksWithMediaType(…)`, though less clear, makes a better job at this.</div><div class=""><br class=""></div><div class="">I can see more methods of this kind in the diff, and they seem to benefit the most.</div><div class=""><br class=""></div><div class="">I mentioned this before, but the way I would prefer this named is `findTracks(…)`, and skip the “with” in the name. The intent is captured better than the original, we start with a verb, and the method name is separated from its parameters. But obviously this is unlikely to work as an automated translation.</div><div class=""><br class=""></div><div class="">Having said that, a lot of the changes seem like a step back:</div><div class=""><br class=""></div><div class=""><br class=""><blockquote type="cite" class="">&nbsp; &nbsp;func&nbsp;highlight(level&nbsp;val: CGFloat)&nbsp;-&gt;&nbsp;NSColor?<span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>&nbsp; &nbsp;func&nbsp;highlight(level&nbsp;val: CGFloat)&nbsp;-&gt;&nbsp;NSColor?<br class="">- &nbsp;func&nbsp;shadow(level&nbsp;val: CGFloat)&nbsp;-&gt;&nbsp;NSColor?<span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>+ &nbsp;func&nbsp;shadowWithLevel(val: CGFloat)&nbsp;-&gt;&nbsp;NSColor?</blockquote><br class=""></div><div class="">Inconsistency. Highlight analyzed as as a verb, shadow as a noun, even though those are obviously related.</div></div></div></blockquote><div class=""><br class=""></div><div class="">Yes, this is an inconsistency we would need to deal with via NS_SWIFT_NAME. “highlight” is acting as an adjective here, although it’s predominantly a verb in Cocoa APIs.</div></div></div></div></blockquote><div><br class=""></div><div>True, but it would seem preferable to me to choose an approach for which having to fix up a name with NS_SWIFT_NAME is a rare occurrence.</div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""></div><div class=""><blockquote type="cite" class="">- &nbsp;func&nbsp;blendedColor(fraction&nbsp;fraction: CGFloat, of&nbsp;color: NSColor)&nbsp;-&gt;&nbsp;NSColor?<span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>+ &nbsp;func&nbsp;blendedColorWithFraction(fraction: CGFloat, of&nbsp;color: NSColor)&nbsp;-&gt;&nbsp;NSColor?</blockquote><br class=""></div><div class="">This doesn’t seem like an improvement. “fraction” and “color” seem very much like parameters to be separated from the name.</div></div></div></blockquote><div class=""><br class=""></div><div class="">Note that this is the intent of the change, however: blendedColor is a noun phrase describing the result, and “withFraction” is a characteristic of the resulting color.</div></div></div></div></blockquote><div><br class=""></div><div>I understand; I just find it a much less compelling example for Jordan’s approach than something like the previously mentioned “tracks”.</div><div><br class=""></div><div>Perhaps the way to differentiate further cases where “with” in the name is useful is: methods that you can imagine being called “findFoo”, and take some argument as a search condition, but without it, only a single noun remains.</div><div><br class=""></div><div>Looking through the diff, methods like these:</div><div><br class=""></div></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div><div>track(trackID&nbsp;trackID: CMPersistentTrackID)&nbsp;-&gt;&nbsp;AVAssetTrack?</div></div><div><div>func&nbsp;tracks(mediaCharacteristic&nbsp;mediaCharacteristic:&nbsp;String)&nbsp;-&gt;&nbsp;[AVFragmentedAssetTrack]</div></div><div><div>class&nbsp;func&nbsp;devices(mediaType&nbsp;mediaType:&nbsp;String!)&nbsp;-&gt;&nbsp;[AnyObject]!</div></div><div><div>class&nbsp;func&nbsp;defaultDevice(mediaType&nbsp;mediaType:&nbsp;String!)&nbsp;-&gt;&nbsp;AVCaptureDevice!</div></div><div><div>func&nbsp;connection(mediaType&nbsp;mediaType:&nbsp;String!)&nbsp;-&gt;&nbsp;AVCaptureConnection!</div></div><div><div>func&nbsp;mutableTrack(compatibleWith&nbsp;track: AVAssetTrack)&nbsp;-&gt;&nbsp;AVMutableCompositionTrack?<span class="Apple-tab-span" style="white-space:pre">        </span></div></div></blockquote><div><div><br class=""></div><div>Bother me the most. But a lot others, I feel like they’re worse off for having “with” back in the name</div><div><br class=""></div><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><blockquote type="cite" class="">- &nbsp;class&nbsp;func&nbsp;availableColorSpaces(model&nbsp;model: NSColorSpaceModel)&nbsp;-&gt;&nbsp;[NSColorSpace]<span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>+ &nbsp;class&nbsp;func&nbsp;availableColorSpacesWith(model: NSColorSpaceModel)&nbsp;-&gt;&nbsp;[NSColorSpace]</blockquote><blockquote type="cite" class="">&nbsp;func&nbsp;indexOfItem(objectValue&nbsp;object:&nbsp;AnyObject)&nbsp;-&gt;&nbsp;Int<span class="Apple-tab-span" style="white-space: pre;">        </span><span class="Apple-tab-span" style="white-space: pre;">        </span>+ &nbsp;func&nbsp;indexOfItemWithObjectValue(object:&nbsp;AnyObject)&nbsp;-&gt;&nbsp;Int</blockquote><br class=""></div><div class="">Same…</div></div></div></blockquote><div class=""><br class=""></div>With the same answer: both start with noun phrases describing the result, so the “with” is acting more like “having”, indicating that the parameter is describing the characteristics of the result.</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""></div><div class=""><br class=""><blockquote type="cite" class="">- &nbsp;func&nbsp;reviewUnsavedDocuments(alertTitle&nbsp;title:&nbsp;String?, cancellable:&nbsp;Bool, delegate:&nbsp;AnyObject?, didReviewAllSelector: Selector, contextInfo:&nbsp;UnsafeMutablePointer&lt;Void&gt;)<span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>+ &nbsp;func&nbsp;reviewUnsavedDocumentsWithAlertTitle(title:&nbsp;String?, cancellable:&nbsp;Bool, delegate:&nbsp;AnyObject?, didReviewAllSelector: Selector, contextInfo:&nbsp;UnsafeMutablePointer&lt;Void&gt;)</blockquote><br class=""></div><div class="">This definitely seem like a step back, “reviewUnsavedDocuments” works really well as a name, without the sort of confusion that the “tracks” mentioned above has.</div></div></div></blockquote><div class=""><br class=""></div><div class="">Somehow, “review” wasn’t in my list of verbs. I’ll fix this.</div></div></div></div></blockquote><div><br class=""></div><div>Another one:</div><div><br class=""></div><div>func&nbsp;invalidateLayoutWith(context: NSCollectionViewLayoutInvalidationContext)</div><div>+ &nbsp;func&nbsp;swapWithMark(sender: AnyObject?)</div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><blockquote type="cite" class="">- &nbsp;class&nbsp;func&nbsp;mouseEvent(type&nbsp;type: NSEventType, location: Point, modifierFlags&nbsp;flags: NSEventModifierFlags, timestamp&nbsp;time: TimeInterval, windowNumber&nbsp;wNum:&nbsp;Int, context: NSGraphicsContext?, eventNumber&nbsp;eNum:&nbsp;Int, clickCount&nbsp;cNum:&nbsp;Int, pressure:&nbsp;Float)&nbsp;-&gt;&nbsp;NSEvent?<span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span></blockquote><blockquote type="cite" class="">+ &nbsp;class&nbsp;func&nbsp;mouseEventWith(type: NSEventType, location: Point, modifierFlags&nbsp;flags: NSEventModifierFlags, timestamp&nbsp;time: TimeInterval, windowNumber&nbsp;wNum:&nbsp;Int, context: NSGraphicsContext?, eventNumber&nbsp;eNum:&nbsp;Int, clickCount&nbsp;cNum:&nbsp;Int, pressure:&nbsp;Float)&nbsp;-&gt;&nbsp;NSEvent?</blockquote><br class=""></div><div class="">This one’s weird. “With” was added, but without “type” in the name.</div></div></div></blockquote><div class=""><br class=""></div><div class="">“type” is redundant with the type info, so it has been pruned.</div></div></div></div></blockquote><div><br class=""></div><div>But is “mouseEventWith” as a name actually desirable?</div></div><br class=""><div class="">* * *</div><div class=""><br class=""></div><div class="">Another thing that bothers me is how this makes method families have different names:</div><div class=""><br class=""><blockquote type="cite" class="">- &nbsp;func&nbsp;indexOfItem(title&nbsp;aTitle:&nbsp;String)&nbsp;-&gt;&nbsp;Int<span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>+ &nbsp;func&nbsp;indexOfItemWithTitle(aTitle:&nbsp;String)&nbsp;-&gt;&nbsp;Int<br class="">- &nbsp;func&nbsp;indexOfItem(tag&nbsp;aTag:&nbsp;Int)&nbsp;-&gt;&nbsp;Int<span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>+ &nbsp;func&nbsp;indexOfItemWithTag(aTag:&nbsp;Int)&nbsp;-&gt;&nbsp;Int<br class="">- &nbsp;func&nbsp;indexOfItem(representedObject&nbsp;object:&nbsp;AnyObject)&nbsp;-&gt;&nbsp;Int<span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>+ &nbsp;func&nbsp;indexOfItemWithRepresentedObject(object:&nbsp;AnyObject)&nbsp;-&gt;&nbsp;Int<br class="">- &nbsp;func&nbsp;indexOfItem(submenu&nbsp;submenu: NSMenu?)&nbsp;-&gt;&nbsp;Int<span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>+ &nbsp;func&nbsp;indexOfItemWithSubmenu(submenu: NSMenu?)&nbsp;-&gt;&nbsp;Int<br class="">- &nbsp;func&nbsp;indexOfItem(target&nbsp;target:&nbsp;AnyObject?, andAction&nbsp;actionSelector: Selector)&nbsp;-&gt;&nbsp;Int<span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>+ &nbsp;func&nbsp;indexOfItemWithTarget(target:&nbsp;AnyObject?, andAction&nbsp;actionSelector: Selector)&nbsp;-&gt;&nbsp;Int</blockquote></div><div class=""><br class=""></div><div class="">I think it would be desirable for this, being essentially a few versions of the same method, just taking different arguments, to have a single name.</div><div class=""><br class=""></div><div class="">This also passes the “you could imagine the name starting with ‘find’” test.</div><div class=""><br class=""></div><div class="">* * *</div><div class=""><br class=""></div><div class=""><br class=""><blockquote type="cite" class="">&nbsp; func&nbsp;smartMagnify(event&nbsp;event: NSEvent)<span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>+ &nbsp;func&nbsp;smartMagnifyWith(event: NSEvent)<br class="">&nbsp; &nbsp;@available(OSX 10.6, *)<span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>&nbsp; &nbsp;@available(OSX 10.6, *)<br class="">- &nbsp;func&nbsp;touchesBegan(event&nbsp;event: NSEvent)<span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>+ &nbsp;func&nbsp;touchesBeganWith(event: NSEvent)<br class="">&nbsp; &nbsp;@available(OSX 10.6, *)<span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>&nbsp; &nbsp;@available(OSX 10.6, *)<br class="">- &nbsp;func&nbsp;touchesMoved(event&nbsp;event: NSEvent)<span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>+ &nbsp;func&nbsp;touchesMovedWith(event: NSEvent)<br class="">&nbsp; &nbsp;@available(OSX 10.6, *)<span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>&nbsp; &nbsp;@available(OSX 10.6, *)<br class="">- &nbsp;func&nbsp;touchesEnded(event&nbsp;event: NSEvent)<span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>+ &nbsp;func&nbsp;touchesEndedWith(event: NSEvent)<br class="">&nbsp; &nbsp;@available(OSX 10.6, *)<span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>&nbsp; &nbsp;@available(OSX 10.6, *)<br class="">- &nbsp;func&nbsp;touchesCancelled(event&nbsp;event: NSEvent)<span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>+ &nbsp;func&nbsp;touchesCancelledWith(event: NSEvent)<br class="">&nbsp; &nbsp;@available(OSX 10.8, *)<span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>&nbsp; &nbsp;@available(OSX 10.8, *)<br class="">- &nbsp;func&nbsp;quickLook(event&nbsp;event: NSEvent)<span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>+ &nbsp;func&nbsp;quickLookWith(event: NSEvent)<br class="">&nbsp; &nbsp;@available(OSX 10.10.3, *)<span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>&nbsp; &nbsp;@available(OSX 10.10.3, *)<br class="">- &nbsp;func&nbsp;pressureChange(event&nbsp;event: NSEvent)<span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>+ &nbsp;func&nbsp;pressureChangeWith(event: NSEvent)</blockquote><br class=""></div><div class="">Not digging this either. Passing NSEvent here feels like passing “sender” — an idiom that seems in no need of adding a “With” suffix to the method name…</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Best,</div><div class="">— Radek</div></body></html>