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

Dave Abrahams dabrahams at apple.com
Thu Feb 4 13:06:06 CST 2016


> On Feb 4, 2016, at 9:07 AM, Charles Constant <charles at charlesism.com> wrote:
> 
> > Even though, this code makes sense:
> >
> > *     a.moveTo( b )*
> >
> > I'd prefer to see this:
> >
> > *     a.move( toPoint: b )*
>  
> The difference between this and the first example isn't a preposition;
> it's a (IMO needless) noun.  What point (NPI) are you trying to
> illustrate?
> 
> It looks like I didn't express myself well enough. My point is, it's not entirely a "needless noun" in the context of an actual project.

Yes, but you phrased it as illustrating something about prepositions.

> In isolation, if your project only has that one function, it's needless. But, when it's sitting there along with dozens of other functions and methods, it's nice if you can predict which the argument labels you're looking for will be called. Because, with my suggestion "toPoint" is  "toPoint" is "toPoint" everywhere and with no exceptions. 

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

> FWIW, your personal style notwithstanding, we *are* standardizing on camelCase
> 
> oK, no more snake case. ;)
> 

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


More information about the swift-evolution mailing list