<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body><div>This is a valid concern.<br></div>
<div>&nbsp;<br></div>
<div>If we assumed that 50% of methods would have a labelled first parameter, and 50% would leave them unlabelled, and furthermore we assume that all methods with labelled first parameters would use the parameter name as the label, then I would support this proposal purely on the grounds that it's easier to write `func foo(_ bar: T)` than it is to write `func foo(bar bar: T)`.<br></div>
<div>&nbsp;<br></div>
<div>However, if we assume that the majority of methods still want an unlabelled first parameter (which seems like a reasonable assumption to me; most of the methods I write would certainly have the first parameter unlabelled), and similarly if we assume that a non-trivial amount of labelled first parameters use a different label than the parameter name, then this change doesn't make as much sense anymore.<br></div>
<div>&nbsp;<br></div>
<div>Another concern with this proposal is that, even if you assume most methods with multiple parameters would want to label all the parameters, it's likely that most methods with a single parameter will leave the parameter unlabelled. But this proposed rule would cause even single-argument methods to label the sole argument.<br></div>
<div>&nbsp;<br></div>
<div>-Kevin Ballard<br></div>
<div>&nbsp;<br></div>
<div>On Wed, Mar 9, 2016, at 05:03 PM, Jordan Rose via swift-evolution wrote:<br></div>
<blockquote type="cite"><div>This is my concern too. Our guidelines often lead to the first parameter having a label, but usually that name isn't the same as the name of the parameter—one's a preposition, the other's a noun. I'm pretty sure the common case is still unlabeled. Does that justify the complexity of the current rule?<br></div>
<div>&nbsp;<br></div>
<div>(But because Objective-C methods will now often have labeled arguments, it would at least no longer be a marker differentiating "pure Swift" code from "Cocoa" code.)<br></div>
<div>&nbsp;<br></div>
<div>Jordan<br></div>
<div>&nbsp;<br></div>
<div>&nbsp;<br></div>
<div><blockquote type="cite"><div>On Mar 9, 2016, at 14:32, Radosław Pietruszewski via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:<br></div>
<div>&nbsp;<br></div>
<div><div style="word-wrap:break-word;-webkit-line-break:after-white-space;"><div>Looking at my code, the majority of methods should still have the first parameter unlabeled.&nbsp;<br></div>
<div>&nbsp;<br></div>
<div>I like the consistency of what you’re proposing and the fact that I don’t have to write `func foo(someArgument someArgument: T)` anymore. But I also fear people won’t get it that they can (and in many, probably most, situations should) make the first parameter `_ foo`.<br></div>
<div>&nbsp;<br></div>
<div><div>— Radek<br></div>
</div>
<div>&nbsp;<br></div>
<div><blockquote type="cite"><div>On 09 Mar 2016, at 19:58, Joe Groff via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:<br></div>
<div>&nbsp;<br></div>
<div><div style="word-wrap:break-word;-webkit-line-break:after-white-space;"><div>Our accepted naming guidelines have embraced first argument labels for functions and methods. This weakens our justification for making the first parameter declaration in a `func` declaration behave differently from the others, implicitly being unlabeled. It seems pretty clear to me we should make all of the parameter declarations behave uniformly:<br></div>
<div>&nbsp;<br></div>
<blockquote style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:40px;border-top-style:none;border-right-style:none;border-bottom-style:none;border-left-style:none;border-top-width:initial;border-right-width:initial;border-bottom-width:initial;border-left-width:initial;border-top-color:initial;border-right-color:initial;border-bottom-color:initial;border-left-color:initial;border-image-source:initial;border-image-slice:initial;border-image-width:initial;border-image-outset:initial;border-image-repeat:initial;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;"><div>func foo(x: Int, y: Int) // Should declare foo(x:y:), instead of foo(_:y:)<br></div>
<div>func foo(_ x: Int, y: Int) // Explicitly declares foo(_:y:)<br></div>
<div>&nbsp;<br></div>
</blockquote><div>This would also make `init` and `func` parameters behave consistently, which is nice. There may still be hope for our keyword argument rules to one day be shorter than the Smalltalk spec…<br></div>
<blockquote style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:40px;border-top-style:none;border-right-style:none;border-bottom-style:none;border-left-style:none;border-top-width:initial;border-right-width:initial;border-bottom-width:initial;border-left-width:initial;border-top-color:initial;border-right-color:initial;border-bottom-color:initial;border-left-color:initial;border-image-source:initial;border-image-slice:initial;border-image-width:initial;border-image-outset:initial;border-image-repeat:initial;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;"><div>&nbsp;<br></div>
</blockquote><div>-Joe<br></div>
</div>
<div>_______________________________________________<br></div>
<div>swift-evolution mailing list<br></div>
<div><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br></div>
<div><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></div>
</div>
</blockquote></div>
<div>&nbsp;<br></div>
</div>
<div>_______________________________________________<br></div>
<div>swift-evolution mailing list<br></div>
<div><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br></div>
<div>https://lists.swift.org/mailman/listinfo/swift-evolution<br></div>
</div>
</blockquote></div>
<div>&nbsp;<br></div>
<div><u>_______________________________________________</u><br></div>
<div>swift-evolution mailing list<br></div>
<div><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br></div>
<div><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></div>
</blockquote><div>&nbsp;<br></div>
</body>
</html>