I haven't yet prepared a formal proposal, but the idea should be understood
by pretty much everyone. This topic has been discussed, but deferred to
"post-Swift3". I think the time for it has come.

Basically, the proposal is to make protocols non-types. To use protocol as
an existential type, it must be wrapped in Any:

protocol ExampleProtocol {
    func foo() -> Int
    func bar() -> String
}

func f<T: ExampleProtocol>()    // OK

func f(x: ExampleProtocol)    // error: ExampleProtocol is not a type
func f(x: Any<ExampleProtocol>)    // OK

This will syntactically separate existential types from protocols
themselves and generic constraints.
The proposal does not allow for much variativity, and it looks like the
proposal can be easily created and submitted.
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to