How to update this code to use parameter packs?

Currently variadic packs allows to create functions with several arguments of related types. In your case I think it is not supposed that subscript can take several key paths like subscript(dynamicMember keyPath1: KeyPath<L1, A>, keyPath2: KeyPath<L2, A>), keyPath3: ...

Instead several subscript overloads are needed, something like:

class CN<each L: P>: A {
  repeat
  subscript(dynamicMember keyPath: KeyPath<each L, A>) -> A {
    return each L(source: self)[keyPath: keyPath]
  }
}

Similar topic has also appeared in another discussion, here is @scanon answer:

I've created a thread, though it should be named better to generalize both cases:

1 Like