[Pitch] Parameter Packs

Spending some amount of time on parameter packs, I wanted to provide some feedback on the current state of parameter packs in Variadic Generics.

Firstly, I often find myself writing code that looks a bit hacky and may be difficult to read due to the lack of something like "repeat" block. For instance, I end up using nested function like the following:

func someVariadicGenericFunction<each T>(argument: repeat each T) -> Value {
    var result: Value  = Value()
    func update<U>(with argument: U) {
        result = someFunction(argument)
    repeat update(with each argument)
    return result 

It would be simpler and cleaner if we had something like repeat block:

var result: Value = Value()
repeat {
    result = someFunction(each argument)
return result

Secondly, it is currently not possible to reuse value packs in a variadic function like print(repeat each value) . Although the syntax itself was accepted as part of SE-0393, it requires another proposal before it can be implemented, as mentioned in this comment. I believe this is a small but important improvement, and I hope to see a proposal for it soon.

Lastly, while trying to implement a variadic ChainSequence in Swift Algorithms, I encountered difficulties in conforming to Collection due to the lack of something like a "variadic union type." Specifically, I couldn't implement a variadic version of this section.

Although I don't have a concrete suggestion to enable this kind of variadic generics, I believe it is an issue worth addressing.