[swift-evolution] named parameters - why hidden first?/proposal interest
salutis at me.com
Sun Jan 24 04:34:32 CST 2016
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:
> - the rule of "least surprise"
> - developers can edit function definitions more quickly
> - 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: ...
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
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution