Hi all,
I'm curious about the status of generalized existentials. From the Generics Manifesto:
Generalized existentials would make it easier to work with protocols with associated types (PATs):
- They enable values with a PAT type (e.g.
let x: Equatable
) - They can replace the type-erasure pattern for dealing with PATs (e.g.
AnyCollection
,AnyHashable
, etc. can become justCollection
,Hashable
with minimal support)- This reduces the jump in difficulty from working with protocols w/o associated types to PATs.
I'm wondering:
- If generalized existentials are on the roadmap for Swift generics
- If people are actively working on generalized existentials
- What's necessary to support generalized existentials
- Is additional runtime support needed to represent "protocol values"?
- Do new user-facing features need to be introduced (e.g. opening existentials)?
- Are there major blockers preventing development?
Thanks!