[swift-evolution] named parameters - why hidden first?/proposal interest
swift-evolution at haravikk.com
Sun Jan 24 05:30:22 CST 2016
> On 24 Jan 2016, at 10:34, Rudolf Adamkovic via swift-evolution <swift-evolution at 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.
> 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 <mailto:swift-evolution at swift.org>
> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution