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

Rudolf Adamkovic salutis at me.com
Sun Jan 24 04:34:32 CST 2016

Reply below.

Sent from my iPhone

> On 24 Jan 2016, at 00:06, Charles Constant via swift-evolution <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?

One extra character?

With our current Objective-C style, we need to repeat at least one word and often need to include "with", "by", "using", etc. to make it read nicely.


splitWithSeparator(_ separator: ...

split(separator: ...

The first form repeats "separator" twice and needs "with". And then there's (as you mentioned) the underscore and the space character. In short, tons of crap.


> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160124/902c1431/attachment.html>

More information about the swift-evolution mailing list