>> These examples require “path-dependent types” to work. There are some examples in the old enhanced existentials draft (although it does not use the term path-dependent types). >> >> Also, fwiw Scala’s type system supports this feature . I don’t know Scala in depth so I’m not sure how closely it relates to what we might have in Swift but you might find it interesting to look at how Scala handles this.
This would be my in-an-ideal-world choice for how existentials eventually work in Swift.