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

Charles Constant charles at charlesism.com
Thu Feb 4 13:48:00 CST 2016


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


I also forgot to mention, "to" is so much more universal, that it stops
being very useful. If we rewrite my contrived example as...

    func rename( fromName="index", fromEx="html", toName="converted",
toExt="shtml" )

The we have labels that I can easily imagine the programmer might want to
search code for, or plug in to a second, similar function. I can imagine
working on a file and thinking "what other functions did i use here that
change an extension" - searching for "toExt" is helpful there, whereas I'm
not sure why I would want to find "to[Anything]." I also find it helps me
understand what functions do, when I'm browsing suggestions from code
completion, but that's only my opinion for me to make, so it's hard for me
to make a convincing argument.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160204/d1772642/attachment.html>


More information about the swift-evolution mailing list