Passing a parameter pack to a function call fails to compile

I'm not saying that this is good enough reason to disallow element indexing, but it would cause inconsistency.

typealias Each<Value, each Element> = Value

func labels<each Element>(
  _ tuple: (repeat each Element, Void)
) -> (repeat Each<String, each Element>, String) {
  var iterator = Mirror(reflecting: tuple).children.map(\.label!).makeIterator()
  return (
    repeat { _ in iterator.next()! } ((each Element).self),
    iterator.next()!
  )
}
#expect(labels((0, 1, ())) == (".0", ".1", ".2")) // ✅
1 Like