# SE-0335: Introduce existential \`any\`

**URL:** <https://forums.swift.org/t/se-0335-introduce-existential-any/53934>\
**Category:** Proposal Reviews\
**Created:** [December 8, 2021, 9:30pm UTC](https://forums.swift.org/t/se-0335-introduce-existential-any/53934 "2021-12-08T21:30:23Z")\
**Posts on this page:** 1\
**Showing post:** 119

<div class="post-metadata">

**Author:** ![Paul\_Cantrell](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/paul_cantrell/32/16764_2.png) [@Paul\_Cantrell](https://forums.swift.org/u/Paul_Cantrell)\
**Post date:** [December 15, 2021, 3:54am UTC](https://forums.swift.org/t/se-0335-introduce-existential-any/53934/119 "2021-12-15T03:54:54Z")

</div>

A good chunk of the debate here centers around whether existentials are a separate, concrete, surface-visible box type of their own, or an implementation detail which is subsumed into the more abstract logic of the type system.

In other words, given this:

```
let x: any P = T()

```

…would we say that…

1. the value `x` **has a** `P` (i.e. is a box that **contains a** `T`), or
2. the value `x` **is a** `P`?

This has been a point of tension in the language, and even within the Swift team itself, at least since I filed [this bug](https://bugs.swift.org/browse/SR-2867) in 2016.

The `Any<P>` counterproposal would seem to lean toward codifying (1): existentials are a programmer-visible box type. The proposed `any P` syntax certainly leans toward (2), and perhaps I like the proposal because (2) is my preferred mental model. But (2) certainly does raise questions like the ones @jackmarch is asking — and I find myself hard-pressed to come up with answers to his questions that don’t lean at least a little on the “visible box” model of (1).

I really like the feature idea Holly mentions here:

> [@hborla](#):
>
> There are potential language features that would allow the above example to compile -- by implicitly opening the existential to produce an opaque type, for example

I remember we discussed it [here](https://forums.swift.org/t/se-0309-unlock-existential-types-for-all-protocols/47515/62), and IIRC Joe Groff mentioned it at some point before that. I hope that idea will come up for consideration soon! It seems like it could help close the loop on making (2) a workable mental model.

(I should clarify that my +1 for this proposal is not contingent on the future adoption or non-adoption of that future direction.)

---

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