[swift-evolution] Removing Variadic Parameters.
Tino Heth
2th at gmx.de
Wed Jul 6 13:38:20 CDT 2016
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
More information about the swift-evolution
mailing list