[swift-evolution] When to use argument labels (a new approach)

Charles Constant charles at charlesism.com
Thu Feb 4 13:22:37 CST 2016

> Why isn't "to" more predictable than "toPoint?"  It's certainly more
> universal.

Function arguments can be unordered, if they have default values. A
contrived example here...

func rename( from nameA="index", from extA="html", to nameB="converted", to
extB="shtml" )

Maybe I'm confused, but that seems like it has to be illegal at worst, and
confusing at best. But if you don't consistently use "from" and "to" then
you're back to making special rules about everything.

It wouldn't matter if every argument has a unique Type, or if you take the
time to create structs or tuples to bundle every piece of data together
about "from" or about "with" etc. Maybe that's usually the case, but it's
nice to have freedom to be lazy.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160204/90941a86/attachment.html>

More information about the swift-evolution mailing list