<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 Oct 2, 2017, at 8:06 PM, Xiaodi Wu &lt;<a href="mailto:xiaodi.wu@gmail.com" class="">xiaodi.wu@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">On Mon, Oct 2, 2017 at 9:55 PM, Slava Pestov <span dir="ltr" class="">&lt;<a href="mailto:spestov@apple.com" target="_blank" class="">spestov@apple.com</a>&gt;</span> wrote:<br class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><br class=""><div class=""><span class=""><blockquote type="cite" class=""><div class="">On Oct 2, 2017, at 7:52 PM, Kelvin Ma &lt;<a href="mailto:kelvin13ma@gmail.com" target="_blank" class="">kelvin13ma@gmail.com</a>&gt; wrote:</div><br class="m_9159439508092008430Apple-interchange-newline"><div class=""><div dir="ltr" class="">Is this only a problem with fileprivate or does it extend to private members too? I feel like this would be a very valuable feature to support.<br class=""></div></div></blockquote><div class=""><br class=""></div></span>Private members too. Consider this example,</div><div class=""><br class=""></div><div class="">struct S {<br class="">&nbsp;&nbsp;private func f() {}<br class="">}</div><div class=""><br class=""></div><div class="">The member S.f mangles as&nbsp;_T06struct1SV1f33_<wbr class="">AB643CAAAE0894CD0BC8584D7CA3AD<wbr class="">23LLyyF. In this case, I suppose we won’t need the private discriminator because there can only be one S.f that’s directly a member of S, and not an extension. However imagine if two different source files both defined extensions of S, with a private member f. You would need to disambiguate them somehow.</div></div></blockquote><div class=""><br class=""></div><div class="">The simple-minded way to do this would be to require @_versioned annotations on private and fileprivate members to supply an internally unique alternative name to be used for mangling-as-though-internal (i.e. `@_versioned(my_extension_f)`). Such a function becoming public in an ABI-compatible way would require renaming the "actual" name to the unique @_versioned name.</div></div></div></div></div></blockquote><div><br class=""></div>We have _silgen_name for that, but we really don’t want to expose this more generally because people have been abusing it to make things visible to C, and they should be using @_cdecl instead.</div><div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""><br class=""></div><div class="">A more elegant refinement could be to have @_versioned private and fileprivate members mangled as though internal, erroring if two or more members with the same name are both @_versioned--would that work?</div></div><br class=""></div></div>
</div></blockquote></div><br class=""><div class="">If you’re going to do that what is the value in having the capability at all?</div><div class=""><br class=""></div><div class="">Slava</div></body></html>