<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">A full-fledged introspection system should provide this information, which I suppose could be useful for creating proxies through code generation or dynamic Objective-C like features, should they ever be added to the language. Would that be sufficient for your needs? It is not clear to me what problem you are trying to solve.</div><div class=""><br class=""></div><div class="">Hopefully I won't stir up too much trouble by saying that this kind of capability is very useful in Objective-C for mocking, for example.</div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On Jul 2, 2017, at 7:55 PM, Daryle Walker via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jul 1, 2017, at 2:07 AM, Brent Royal-Gordon &lt;<a href="mailto:brent@architechies.com" class="">brent@architechies.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><blockquote type="cite" class=""><div class="">On Jun 30, 2017, at 6:17 PM, Daryle Walker via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">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</div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>typealias MyProtocol = Protocol1 &amp; Protocol2</div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">(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.</div></div></blockquote><br class=""></div><div class="">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.</div></div></div></blockquote></div><div class=""><br class=""></div><div class="">It wasn’t until I started this thread that I realized that Swift didn’t have a way to get a bulk list of a type’s protocols. A little later, I came up with a reason why this never came up before (or at least not often): knowing this isn’t really useful.</div><div class=""><br class=""></div><div class="">You could use this to make MyTypeB conform to all protocols of MyTypeA. But then you’re stuck. The list of protocols for a type is a closed from the linker’s perspective, but open from the user’s perspective. The user couldn’t write all the methods needed unless the unknown ones all have default implementations. The proposal I’m coming up with has a facility to copy all the members of one type to another. You can specify by exact member name, or you can specify a protocol to get copies of all applicable members at once. This is where an all-protocols alias can help. With manual copying, the user’s cardinality of members copied is usually less than what’s available, with an automatic list the cardinalities are always equal.</div><div class=""><br class=""></div><div class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">—&nbsp;</div><div class="">Daryle Walker<br class="">Mac, Internet, and Video Game Junkie<br class="">darylew AT mac DOT com&nbsp;</div><div class=""><br class=""></div></div></div></div></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></body></html>