<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jul 2, 2017, at 10:15 PM, Christopher Kornher <<a href="mailto:ckornher@me.com" class="">ckornher@me.com</a>> 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="">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></div></blockquote><br class=""></div><div>I have the proposal for my use case out now at <<a href="https://gist.github.com/CTMacUser/c493f775075e946efdcfd85d38473291" class="">https://gist.github.com/CTMacUser/c493f775075e946efdcfd85d38473291</a>>.</div><div><br class=""></div><div>Look at:</div><div><br class=""></div><div><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px;" class=""><font face="Monaco" class="">alter MyInt16: Int16, Hashable {</font></blockquote><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px;" class=""><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px;" class=""><font face="Monaco" class="">publish Equatable</font></blockquote><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px;" class=""><font face="Monaco" class="">var hashValue: Int {</font></blockquote></blockquote><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px;" class=""><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px;" class=""><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px;" class=""><font face="Monaco" class="">return 2000 &+ super.hashValue</font></blockquote></blockquote></blockquote><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px;" class=""><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px;" class=""><font face="Monaco" class="">}</font></blockquote></blockquote><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px;" class=""><font face="Monaco" class="">}</font></blockquote><div class=""><font face="Monaco" class=""><br class=""></font></div></div><div>If I wanted to copy Int16 completely, I couldn’t write the full protocol list because it’s open-ended from the user’s perspective due to extensions. However, the list is closed from the compiler/linker’s perspective, so we can synthesize an all-protocol list:</div><div><br class=""></div><div><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px;" class=""><font face="Monaco" class="">alter MyInt16: Int16, #protocols(Int16), ANewProtocol {</font></blockquote><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px;" class=""><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px;" class=""><font face="Monaco" class="">publish #protocols(Int16)</font></blockquote><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px;" class=""><font face="Monaco" class="">// Define new members here, some of which implement ANewProtocol....</font></blockquote><span style="font-family: Monaco;" class="">}</span></blockquote><div class=""><font face="Monaco" class=""><br class=""></font></div></div><div>Besides this, maybe we could do some analysis using #protocols(MyType).Protocol. (Oh, completely copying Int16 is still useful because functions with them are considered separate overloads, unlike a type-alias.)</div><div><br class=""></div><div>I’m not sure what you mean by a full-fledged introspection system, but my current use for it requires a solution that is 100% workable at compile-time.</div><div><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="">— </div><div class="">Daryle Walker<br class="">Mac, Internet, and Video Game Junkie<br class="">darylew AT mac DOT com </div><div class=""><br class=""></div></div></div></div></body></html>