<div dir="ltr">I have a few cases like that in production code with an unthread safe private function shadows a more public function that applies thread safety for external callers, etc.<div><br></div><div>-Shawn<br><br><div class="gmail_quote"><div dir="ltr">On Tue, Mar 21, 2017 at 9:37 AM Tino Heth via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:<br></div><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="gmail_msg"><div class="gmail_msg"><br class="gmail_msg"><blockquote type="cite" class="gmail_msg"><div class="gmail_msg"><div style="font-family:Helvetica,Arial;font-size:13px;word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><blockquote type="cite" style="font-family:Helvetica,Arial;font-size:13px;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;border-top-width:1px;border-right-width:1px;border-bottom-width:1px;padding-left:5px;border-left-width:1px!important;border-left-color:rgb(0,64,128)!important" class="gmail_msg"><span style="font-family:&#39;helvetica Neue&#39;,helvetica;font-size:14px" class="gmail_msg">&gt; Fact is, you can replace every occurrence of &quot;private&quot; with &quot;fileprivate&quot;, and your source would compile as before, whereas fileprivate saves us from a &quot;friend&quot;-keyword.</span></blockquote></div><p class="gmail_msg">This is certainly a source-breaking change.  Consider:</p><blockquote type="cite" style="border-top-width:1px;border-right-width:1px;border-bottom-width:1px;padding-left:5px;border-left-width:1px!important;border-left-color:rgb(0,64,128)!important" class="gmail_msg"><p class="gmail_msg">struct Foo {</p><p class="gmail_msg">    fileprivate func foo()-&gt;String {return &quot;foo&quot; }</p><p class="gmail_msg">    private func foo()-&gt;Int {return 2}   </p><p class="gmail_msg">}</p><p class="gmail_msg">print(&quot;\(Foo().foo())&quot;)</p></blockquote><p class="gmail_msg">Replacing “private” with “fileprivate” here will introduce a compile error.</p></div></div></blockquote></div></div><div style="word-wrap:break-word" class="gmail_msg">True indeed… but can we agree that this is just an hypothetic example, and no issue that is likely to happen in productive code?<div class="gmail_msg">Or is this actually taken from one of the projects you measured?</div></div>_______________________________________________<br class="gmail_msg">
swift-evolution mailing list<br class="gmail_msg">
<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="gmail_msg">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="gmail_msg">
</blockquote></div></div></div>