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

Matthew Judge matthew.judge at gmail.com
Fri Feb 5 05:58:03 CST 2016


I believe David is saying that's an orthogonal issue. i.e.

a.readFromSource(u, ofType: b)
vs.
a.readFrom(source: u, ofType: b)
vs.
a.read(fromSource: u, ofType: b)

Is a separable issue from:

a.readFrom(source: u, ofType: b)
vs.
a.readFrom(u, ofType: b)

-or-

a.read(source: u, ofType: b)
vs.
a.read(u, ofType: b)

I don't agree they are completely orthogonal since I think we potentially end up with different results based on which order these two issues are addressed, but I still think David's point is valuable in thinking about What the guidelines should be.


On Feb 5, 2016, at 03:37, Brent Royal-Gordon via swift-evolution <swift-evolution at swift.org> 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
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution


More information about the swift-evolution mailing list