[swift-evolution] When to use argument labels, part DEUX (was: when to use argument labels (a new approach))

Thorsten Seitz tseitz42 at icloud.com
Sat Feb 6 12:46:42 CST 2016


> Am 06.02.2016 um 19:27 schrieb Tino Heth via swift-evolution <swift-evolution at swift.org>:
> 
> It's a very long (and complicated) thread, so I guess the following thought isn't new:
> 
>>  a.move(from: b, to: c)
> In cases like this, where there are nouns that describe the parameters as good as "from" and "to", so I would call the method
> 
> a.moveFile(source: b, destination: c)
> 
> ("File" is just a placeholder; I think move is to ambiguous)
> 
> The advantage of nouns is that they are well suited as variable names as well; the ability to have separate internal and external names is rather exotic, so I think it looks less strange to somebody without an Objective-C/Swift background.

That feature is something I like very much in Swift and being able to name the method

a.moveFile(source: b, to destination: c)

is a great thing as it makes the call site read much better.

Not using a great feature of a language just because somebody might not be used to it because other languages domnot have this feature would make me sad.

-Thorsten 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160206/f511e22a/attachment.html>


More information about the swift-evolution mailing list