[swift-evolution] [swift-evolution-announce] [Review] SE-0023 API Design Guidelines

Michael Wells michael at michaelwells.com
Tue Feb 2 10:33:10 CST 2016


>> 
>> 
>>> What is your evaluation of the proposal?
>>> 
>>> I’m a big fan of guidelines like these so count me as a strong +1.
>>> 
>>> In general
>>> 
>>> I’m supportive of lowerCamelCase for enumerations. 
>>> I’m still not sure about the first argument label
>>> suggestions. Personally, I’d prefer that the first argument always
>>> include a label, but I know that is not a popular opinion.
>> 
>> What would you use for a label here, and why?
>> 
>>  someSet.remove(someElement)
> 
> Maybe I am misunderstanding, or maybe I am projecting my opinion, but I believe he meant that the first argument is explicit by default, like all other arguments. your example would just become (keeping the same use-site syntax):
> 
> func remove(_ element: Element)
> 
> Btw, if it wasn’t clear, that is also my opinion.
> 
> David.

Good point. My brain is almost always thinking of at least two arguments. I’d probably vote for dropping the first argument label for the example you’ve shown, but I wouldn’t argue if it too were made explicit.

someSet.remove(someElement) 

vs.

someSet.remove(element: someElement)

When made explicit, the argument label matches the syntax you’d use in an initializer. 



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


More information about the swift-evolution mailing list