SE-0309: Unlock existential types for all protocols

By that definition, some P isn't existential. some P is shorthand, with the added benefit of hiding the real type from the caller. But that's all a compiler trick. some P is a stand-in from the perspective of the developer, never the compiler.

some P behaves like the following:

// magic modifier to hide the real type from everyone else.
private(type) typealias HiddenP = Int

public func f() -> HiddenP {}

One would not consider HiddenP to be an existential, and some P is nothing more than Swift's actual implementation of my made-up typealias modifier.

4 Likes