[swift-evolution] [Guidelines, First Argument Labels]: Prepositions inside the parens

Brent Royal-Gordon brent at architechies.com
Thu Feb 11 15:51:28 CST 2016


>> Between these two (sorry to repeat the same example again):
>> 
>> func trackWith(trackID trackID: CMPersistentTrackID) -> AVAssetTrack?
>> func track(withTrackID trackID: CMPersistentTrackID) -> AVAssetTrack?
> 
> I think this one particular function is possibly the worst case in the entire API. Neither “track” nor “trackWith” is a particularly good function name. But as I mentioned in a previous post, I think, for many of the Foundation functions, moving the prepositional phrase into the argument label actual aids clarity slightly. I was surprised that I ended up liking it, but I do.

Looking at the fourth function in the diff and saying "I think this is probably the worst API in the frameworks" is a bit like looking at Jupiter and saying "I think this is probably the biggest planet in the universe". With such a small sample out of such a large set, it's far more likely that APIs with the defects seen here are *common*.

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list