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

David Owens II david at owensd.io
Fri Feb 5 09:07:25 CST 2016


I'm saying that which one doesn't matter for how argument labels should be used. 

I think the question of which is more "swifty" is a good one to ask. However, I also do not think it always has the same answer. 

Sent from my iPhone

On Feb 5, 2016, at 12:37 AM, Brent Royal-Gordon <brent at architechies.com> wrote:

>> Here are then the examples of good use cases:
>> 
>> No First Argument Labels
>> 
>> a.readFrom(u, ofType: b)          // yes, satisfies rules 1 and 2
>> a.readFrom(source: u, ofType: b)  // no, source is explicitly derived by “From”
>> 
>> Keep First Argument Labels Labels
>> 
>> a.read(u, ofType: b)          // no, it’s not clear what u’s role is
>> a.read(source: u, ofType: b)  // yes, the source being read is not clear, it could be stdin,
> 
> Okay, but which should it be? `readFrom(_:...)` or `read(source:...)`? These two APIs have very different flavors, and you seem to be saying that either one is okay. That's not a very good thing if we're trying to define what "Swifty" APIs look like.
> 
> -- 
> Brent Royal-Gordon
> Architechies
> 


More information about the swift-evolution mailing list