[swift-evolution] named parameters - why hidden first?/proposal interest

Dave Abrahams dabrahams at apple.com
Sun Jan 24 12:27:48 CST 2016


on Sat Jan 23 2016, Charles Constant <swift-evolution at swift.org> wrote:

>> but what I found was that my APIs generally fell in line naturally with
>> the defaults.
>
> And when they didn't, looking for a way to take advantage of the defaults
>> often
>> led to a better API
>
> I'm not sure I follow this. A change would result in:
>
> Pros:
> - the rule of "least surprise"
> - developers can edit function definitions more quickly
>
> Cons:
> - one extra character (i.e.: from "*foo: Int*" to "*_ foo: Int*")
> - one missed opportunity to set an example of "good style"
>
> Am I missing something?

Just that we want the defaults to encourage better API design.  There
are no perfect answers here, but I think we have a good balance.

-- 
-Dave



More information about the swift-evolution mailing list