[swift-evolution] Would having "MyType.Protocol" to indicate a type's protocols mess anything up?
darylew at mac.com
Fri Jun 30 20:16:58 CDT 2017
> On Jun 30, 2017, at 8:49 PM, Adrian Zubarev <adrian.zubarev at devandartist.com> 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.
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 <https://github.com/DevAndArtist/swift-evolution/blob/refactor_existential_metatypes/proposals/0126-refactor-metatypes.md>
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution