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

Jessy Catterwaul mr.jessy at gmail.com
Thu Feb 11 08:23:32 CST 2016


> Besides — this seems like an edge case anyway. I very rarely see invocations long enough to be compelled to split it into multiple lines, and even if I would, I’d do it like this:
> 
> 	attachmentFor(image: …,
> 				extraParam: ….)

Rule: invocation may use two parameters on the same line, unless that’s too long.
Hack: Use the same line for poorly-named methods names that look like they came form Objective-C.

function(argument1: 1, argument2: true)

function(
   argument1: 1,
   argument2: true,
   argument3: "Troo"
)

functionWithLongName(
   longArgumentLabel1: longArgumentName,
   longArgumentLabel2: longArgumentName
)

functionNamedWrongWithArgument1(1,
   argument2: true,
   argument3: "Troo"
)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160211/37861df1/attachment.html>


More information about the swift-evolution mailing list