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

Thorsten Seitz tseitz42 at icloud.com
Sat Feb 6 11:18:09 CST 2016


Am 06.02.2016 um 02:59 schrieb Dave Abrahams via swift-evolution <swift-evolution at swift.org>:

>> When the natural semantic relationship between the arguments is
>> stronger than the relationship between the method name and the first
>> argument, use first argument labels, whether the label is a noun or a
>> preposition:
>> 
>> a.move(from: b, to: c)
>> a.login(username: b, password: c)
> 
> You don't need this additional guideline to get
> 
>  a.login(username: b, password: c)
> 
> a login b is not part of a grammatical phrase with the right semantics,
> therefore the first argument gets a label.  

Could you explain why `a login b` is not sufficient? Is it because I cannot log in a username but only a user?

-Thorsten 


More information about the swift-evolution mailing list