# \[Pitch\] Introduce existential \`any\`

**URL:** <https://forums.swift.org/t/pitch-introduce-existential-any/53520>\
**Category:** Pitches\
**Created:** [November 16, 2021, 3:48am UTC](https://forums.swift.org/t/pitch-introduce-existential-any/53520 "2021-11-16T03:48:13Z")\
**Posts on this page:** 1\
**Showing post:** 84

<div class="post-metadata">

**Author:** ![dabrahams](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/dabrahams/32/9815_2.png) [@dabrahams](https://forums.swift.org/u/dabrahams)\
**Post date:** [November 18, 2021, 2:44am UTC](https://forums.swift.org/t/pitch-introduce-existential-any/53520/84 "2021-11-18T02:44:51Z")

</div>

Hi @hborla, it's great to see that you're working on this problem. Of course it is my duty to trot out, briefly, the points I [always](https://forums.swift.org/t/unlock-existential-types-for-all-protocols/40665/37) | [bring](https://forums.swift.org/t/introduce-any-p-as-a-better-way-of-writing-existentials/39823/39) | [up](https://forums.swift.org/t/lifting-the-self-or-associated-type-constraint-on-existentials/18025/116) on this topic:

- We will someday need to represent things like “any `Collection` whose `Element` is `Int`.” The natural way to spell it in Swift is something like “`Collection where Element == Int`” (I know there's been talk out there about `Collection<.Element == Int>` but I honestly can't see how angle brackets improve on `where`).
- The more constraints you add to an existential, the more of the protocol's declared API becomes available.
- “`any P`” doesn't read like a thing that's _only going to expose **part** of the API that every `P` in fact must expose_, which has always been my worry about existentials. If every `P` is declared to have a `foo` property and I am handling something called “`any P`,” it's not obvious why it has no `foo`, any more than it's obvious why `P` has no `foo` today.
- “`P where _`” ain't pretty, but it at least suggests that something is unknown, and you might need to add something.
- We could add `any` to the front of these syntaxes, and I don't object to it if people like it… but it isn't adding anything essential once you have ”`P where _`.”

Phew, duty done 🖖

Oh, whoa, I just noticed this:

> [@hborla](#):
>
> ```swift
> func test<T>(_: T) where T == any P
> 
> ```

What's that supposed to mean? IIUC `any P` is a concrete type in this proposal but you're not allowed to write

```swift
func test<T>(_: T) where T == Int // Int is a cocrete type

```

at least, IIRC.

-Dave

---

_[View the full topic](https://forums.swift.org/t/pitch-introduce-existential-any/53520)._
