[swift-evolution] When to use argument labels, part DEUX

Dave Abrahams dabrahams at apple.com
Thu Feb 11 13:11:35 CST 2016


on Thu Feb 11 2016, Charles Kissinger <swift-evolution at swift.org> wrote:

>> On Feb 11, 2016, at 4:02 AM, Gwendal Roué via swift-evolution <swift-evolution at swift.org> wrote:
>> 
> [snipped]
>> 
>> If such convention were to be adopted, we could throw away our favorite grep tools.
>> 
>> Functions with many parameters are often more legible when their invocation is split across several lines. And generally speaking, a developer can liberally call a function on a single line, or on several lines:
>> 
>> 	attachmentFor(image: …, extraParam: …)
>> 	attachmentFor(
>> 	    image: …,
>> 	    extraParam: …)
>> 
>> OK so now if I want to look for all invocations of attachmentFor(image:extraParam:) in my code, I have to look for "attachmentFor", and get all the unrelated results attachmentFor(data:…), attachmentFor(fileURL:…), etc.
>
> The “Find>References” function in Xcode will let you specifically find
> functions like these that differ only in their parameter labels. As I
> mentioned earlier in this thread, if you’re on Linux or just using
> different tools, you’re right: it does become a difficult problem to
> do it reliably.

I can't speak for other tools, but Emacs regexps work across line
boundaries, and <https://www.emacswiki.org/emacs/FindrPackage> will let
you do that kind of searching across directory hierarchies.

-- 
-Dave



More information about the swift-evolution mailing list