Named parameters - why hidden first?/proposal interest

Why not use split(withSeparator separator) instead?

The external parameter name still completes the natural language style, while allowing other split functions to be grouped together under a single action name (split). Personally I think is the best of both, in essence when you’re using the function/method you’re defining the action you want (split) then how you want to do it (withSeparator) which seems nice and logical.

- Haravikk

···

On 24 Jan 2016, at 10:34, Rudolf Adamkovic via swift-evolution <swift-evolution@swift.org> wrote:

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.

Compare:

1.
splitWithSeparator(_ separator: ...

2.
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.

R+
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org <mailto:swift-evolution@swift.org>
https://lists.swift.org/mailman/listinfo/swift-evolution