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

Dave Abrahams dabrahams at apple.com
Mon Feb 8 00:16:28 CST 2016

on Sun Feb 07 2016, ilya <swift-evolution at swift.org> wrote:

> One can consider everything inside the parentheses to be an argument list
> and read them as "with/using an argument list". It works well if the
> preceding part has a verb, such as
> copy(zone: ...)
> -> "Copy with [a single argument] zone equal to ..."
> func doSomethingWith(completionHandler: (()->Void)? = nil)
> -> "doSomething with a given completion handler or do something with a
> default argument list."
> Not sure if there's any value in spelling it out. I believe we use "with"
> so it in Objective-C mostly out of necessity and can easily omit it in
> Swift.

There are a great number of vacuous uses of "with" in Objective-C API
names, but some of them are meaningful... which makes the importer's
job quite tricky.


More information about the swift-evolution mailing list