# Enhanced Variadic Parameters

**URL:** <https://forums.swift.org/t/enhanced-variadic-parameters/22944>\
**Category:** Pitches\
**Created:** [April 11, 2019, 2:30am UTC](https://forums.swift.org/t/enhanced-variadic-parameters/22944 "2019-04-11T02:30:54Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![technicated](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/technicated/32/5420_2.png) [@technicated](https://forums.swift.org/u/technicated)\
**Post date:** [April 11, 2019, 8:22am UTC](https://forums.swift.org/t/enhanced-variadic-parameters/22944/4 "2019-04-11T08:22:28Z")

</div>

This seems to be a very nice addition to the language! And I totally agree with:

> [@anandabits](#):
>
> Further, `Array` is priveleged as _the only_ type that is supported by variadic parameter syntax. **This is at odds with Swift's otherwise pervasive support for user-defined types in its literal syntax.**

In my opinion this design also fits well with my latest document on [variadic generics](https://forums.swift.org/t/variadic-generics/20320), in which I'm proposing the `variadic` keyword to create a VG:

```swift
// Old fashioned way: a function that accepts one or more `P`s, all of the
// same concrete type. `values` is an `Array` inside the function.
func variadicFn1<P: SomeProto>(_ values: P...) { }

// Proposed syntax: a function that accepts a list of `P`s as a real list, as
// an array literal or as an `Array` instance (all values have the same
// concrete type). `values` is an `Array` inside the function.
func variadicFn2<P: SomeProto>(_ values: variadic [P]) { }

// Proposed syntax: a function that accepts a dictionary from `String`s to
// `P`s as a real list (with labels), as a dictionary literal or as a `Dictionary`
// instance (all values have the same concrete type). `values` is a
// `Dictionary` inside the function.
func variadicFn3<P: SomeProto>(_ values: variadic [String: P]) { }

// Variadic Generics syntax: a function that accepts one or more `P`s,
// all of potentially different concrete types. `values` is a "pack of values"
// (strawman WIP name) inside the function.
func variadicFn4<variadic P: SomeProto>(_ values: P) { }

```

---

_[View the full topic](https://forums.swift.org/t/enhanced-variadic-parameters/22944)._
