[Pitch] Parameter Packs

Yeah. Perhaps this limitation can be removed if we introduced labeled generic arguments at the same time, but that feels like a separate feature.

Another trick is that you can use a conformance requirement to a protocol with associated types to turn one type parameter into several. Eg,

protocol P {
  associatedtype A
  associatedtype B
}

struct G<T...> where T: P {}

Now inside the body of G, T.A and T.B are two pack type parameters with the same length.

3 Likes