[swift-evolution] Removing Variadic Parameters.

David Rönnqvist david.ronnqvist at gmail.com
Wed Jul 6 15:13:18 CDT 2016


I'd be reluctant to remove variadic parameters. We've found on our team that variadic arguments are easier to read on the call site compared to array arguments, especially when it's common to pass a single value (but still possible to pass multiple values).

- David

> On 6 Jul 2016, at 20:38, Tino Heth via swift-evolution <swift-evolution at swift.org> wrote:
> 
> It's a late answer… but I wanted to be a good citizen and checked if the topic has been discussed before; so, it seems that is not the case ;-)
> 
> In short, I agree:
> Variadic parameters are somewhat cool, and I think I was exited when I've seen them in C the first time… but I afair, I never created a variadic function in production code, and I think I just used them for the first time in Swift (I checked wether print is variadic…)
> As of today, string interpolation has several advantages over old-style string-formatting, and I can't remember any other method in one of the established libraries that uses this feature:
> Explicitly creating an array is just two additional characters, which doesn't matter in a long list (which imho shouldn't be crammed into the function call anyways), and when there are only a few parameters, you can mimic variadics with Optionals defaulted to nil — and who knows what the long-awaited hygienic macros might do to the importance of variadic parameters.
> 
> Additionally, variadic parameters compete with trailing closures, which for me would always win the struggle for the last parameter ;-)
> 
> As I said, I can't remember a single use case in Swift — and I already utilized quite a lot of the "strange" techniques (currying, tuple splat, complicated combinations of generics & protocols…).
> So for me, the answer to the question "would I add this feature to Swift if it wasn't there?" is a clear no…
> 
> Tino
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution


More information about the swift-evolution mailing list