Lifting the "Self or associated type" constraint on existentials

FWIW, I don't know the term “PAT.”

As to why, I thought I explained it, but let me try again, in fewer words this time.

  • An existential type is fundamentally different from a type conforming to the corresponding protocol. When existentials are allowed to be created from protocols with arbitrary requirements, we create the “some of P's requirements can't be used on a P” and “P does not conform to P” paradoxes, which are very bad for usability and comprehensibility.
  • We intend to support protocols evolving to add new requirements, as long as they are defaulted. If we allow arbitrary new requirements to be added to a protocol that has been used as an existential, we either have to live with “P does not conform to P,” or adding new requirements with defaults may break existing code.
  • Declaring these protocols differently would allow the compiler to prevent us from creating these difficulties.
4 Likes