# Pitching The Start of Variadic Generics

**URL:** <https://forums.swift.org/t/pitching-the-start-of-variadic-generics/51467>\
**Category:** Pitches\
**Tags:** generics\
**Created:** [August 24, 2021, 8:48pm UTC](https://forums.swift.org/t/pitching-the-start-of-variadic-generics/51467 "2021-08-24T20:48:12Z")\
**Posts on this page:** 1\
**Showing post:** 22

<div class="post-metadata">

**Author:** ![Jumhyn](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jumhyn/32/3891_2.png) [@Jumhyn](https://forums.swift.org/u/Jumhyn)\
**Post date:** [August 25, 2021, 2:23pm UTC](https://forums.swift.org/t/pitching-the-start-of-variadic-generics/51467/22 "2021-08-25T14:23:29Z")

</div>

I also like the "zero or more" regular expression connection that the `T*` spelling admits (and could we add `T+` as a lightweight "one or more" spelling in the future...?).

On the whole, though, I don't think we _need_ to optimize for super terse syntax here, so I'd be fine with the `variadic T` spelling as well.

Another thing I've been mulling over is whether we need to have a bright-line distinction between "type sequences" and "tuples". That is, if we add all the special operators (`_countTypeSequence`, `_mapTypeSequence`, etc.), would it be sufficient to say that a generic parameter `T*` declares a type `T` which stands for a tuple of arbitrary arity? Then, we could have a tuple-splat operator for turning a `T` value into its constituent parts (for e.g. function application). This might also dovetail nicely with [`@expanded`](https://forums.swift.org/t/gsoc-shared-storage-for-property-wrappers-and-expanded-parameters/51355) to give us a way of expanding a variadic tuple into a parameter list, e.g.:

```swift
func variadic<Tuple*>(args: @expanded Tuple)
// or
func variadic<Tuple*>(args: #splat(Tuple))
// or, maybe 'Tuple' means the tuple version of the 
// type, and 'Tuple*' the splatted version
func variadic<Tuple*>(args: Tuple*)

```

all of these could indicate that `variadic` is callable as:

```swift
variadic("Hello", 1, 2.0)

```

This could also imply (though it wouldn't _have_ to) that all the special type sequence operations would be applicable to fixed-size tuples as well:

```swift
for elt in ("Hello", 1, 2.0) {
  // elt is 'Any' here?
}

```

Is there any reason we _need_ to treat type sequences as their own first-class "thing" as opposed to making them "just" tuples of variadic arity, and improving support for operating on arbitrary tuples?

---

_[View the full topic](https://forums.swift.org/t/pitching-the-start-of-variadic-generics/51467)._
