[swift-evolution] Would having "MyType.Protocol" to indicate a type's protocols mess anything up?
brent at architechies.com
Sat Jul 1 01:07:39 CDT 2017
> On Jun 30, 2017, at 6:17 PM, Daryle Walker via swift-evolution <swift-evolution at swift.org> wrote:
> 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.
Leave the syntax aside. What are you planning to do with this feature? I understand that you want to have some way of saying "composition of all protocols this type conforms to"; I don't understand *why* you want it or what kind of code you would need it for.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution