I’m not at a computer to test this, but would this work:
typealias T = P1 & P2
extension C: T {}
Now T is C.Protocol
> On Jun 30, 2017, at 9:17 PM, Daryle Walker via swift-evolution
> <[email protected]> wrote:
>
>
>> On Jun 30, 2017, at 8:49 PM, Adrian Zubarev
>> <[email protected]> wrote:
>>
>> What are you proposing here, I don’t get it?! What role should .Protocol
>> play? .Protocol is an ugly hack in Swift which should be removed anyway. It
>> does more harm than good.
>>
> I’m not proposing anything right now. I’m asking a question; the proposal
> that needs the answer can be put off for later.
>
> Given a type MyType, how can I get a type-alias to the type’s protocols? If
> MyType conforms to Protocol1 and Protocol2, I would want something like
>
> typealias MyProtocol = Protocol1 & Protocol2
>
> (and Any if MyType doesn’t conform to any protocols). Does this facility
> already exist in Swift? I don’t think it does, so I proposed the hybrid
> “MyType.Protocol” syntax to express the idea.
>
> If you don’t like the current “.Protocol” syntax, then I guess you don’t like
> it for this idea. I’m also requesting suggestions for alternate syntax.
>
> #protocols(MyType)
>
> is an example.
>
> I guess this should be a separate proposal from my other one.
>> Our revised proposal was deferred from Swift 4:
>>
>> https://github.com/DevAndArtist/swift-evolution/blob/refactor_existential_metatypes/proposals/0126-refactor-metatypes.md
>>
>
> —
> Daryle Walker
> Mac, Internet, and Video Game Junkie
> darylew AT mac DOT com
>
> _______________________________________________
> swift-evolution mailing list
> [email protected]
> https://lists.swift.org/mailman/listinfo/swift-evolution
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution