<div dir="ltr">Jordon Rose from Apple said:<div><br></div><div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div>&quot;It&#39;s tracked by <a href="https://bugs.swift.org/browse/SR-3908" target="_blank">SR-3908</a><div style="display:inline-block;width:16px;height:16px"></div>. (The description&#39;s a little different but it&#39;s the same underlying issue.)&quot;</div></blockquote></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature">  -- Howard.<br></div></div>
<br><div class="gmail_quote">On 21 June 2017 at 12:07, David Baraff <span dir="ltr">&lt;<a href="mailto:davidbaraff@gmail.com" target="_blank">davidbaraff@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><blockquote type="cite"><div>On Jun 20, 2017, at 6:59 PM, Howard Lovatt &lt;<a href="mailto:howard.lovatt@gmail.com" target="_blank">howard.lovatt@gmail.com</a>&gt; wrote:</div><br class="m_-7971293511508974177Apple-interchange-newline"><div><div dir="ltr">There is a *bug* that the Swift people know about, but you are **meant** to be able to do this:</div></div></blockquote><div><br></div><div>Is there a plan to fix this?</div><div>If it worked properly this would be quite wonderful.</div><div><br></div><br><blockquote type="cite"><div><div dir="ltr"><div><br></div><div><blockquote style="font-size:12.8px;margin:0px 0px 0px 40px;border:none;padding:0px">ModuleA<br><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">A.swift</blockquote><span class="m_-7971293511508974177gmail-m_8276977146152905134gmail-im"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">public protocol P {</blockquote></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">func m() -&gt; String</blockquote></blockquote></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">}<br></blockquote></blockquote></span><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">extension Int: P {</blockquote></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">public func m() -&gt; String { <span style="font-size:12.8px">return &quot;AP.m&quot; </span><span style="font-size:12.8px">}</span></blockquote></blockquote></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">}<br></blockquote></blockquote></blockquote><blockquote style="font-size:12.8px;margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"></blockquote>ModuleB<br><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"></blockquote>B.swift<br><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><span class="m_-7971293511508974177gmail-m_8276977146152905134gmail-im">public protocol P {<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">func m() -&gt; String</blockquote>}<br></span>extension Int: P {<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">public func m() -&gt; String { <span style="font-size:12.8px">return &quot;BP.m&quot; </span><span style="font-size:12.8px">}</span></blockquote>}<br></blockquote></blockquote></blockquote><blockquote style="font-size:12.8px;margin:0px 0px 0px 40px;border:none;padding:0px">ModuleC<br><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">A.swift</blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">import ModuleA</blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">func am(_ i: Int) -&gt; String { return i.m() }<br></blockquote></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">B.swift<br></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">import ModuleB</blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">func bm(_ i: Int) -&gt; String { return i.m() }<br></blockquote></blockquote></blockquote><blockquote style="font-size:12.8px;margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">main.swift<br></blockquote></blockquote><blockquote style="font-size:12.8px;margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"></blockquote></blockquote>let i = 0<br><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"></blockquote></blockquote>print(am(i))<br>print(bm(i))</blockquote></blockquote></blockquote></div></div><div class="gmail_extra"><br clear="all"><div><div class="m_-7971293511508974177gmail_signature" data-smartmail="gmail_signature">  -- Howard.<br></div></div>
<br><div class="gmail_quote">On 21 June 2017 at 00:02, David Baraff via swift-users <span dir="ltr">&lt;<a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">I posted this on Apple’s developer forums, and someone suggested trying this here.<div>Basically, see <a href="https://forums.developer.apple.com/thread/80349" target="_blank">https://forums.developer.a<wbr>pple.com/thread/80349</a></div><div><br></div><div>but in a nutshell: consider that a widely used class/struct (such as CGPoint) is missing some “obvious” functionality [don’t debate that part, just go with it for now], such as the ability to scale a point by a scalar using * as an operator: so in my awesome library “GeometryBase” I write</div><div><br></div><div>  public func * (left: CGPoint, right: double) -&gt; CGPoint {</div>      return CGPoint(x: right*left.x, y: right*left.y)<br>  }<div><br></div><div>Why public?  Well, of course, because I want to use library GeometryBase in many apps or other libraries, and now this overload exists in only one place.</div><div><br></div><div>But other bright people have the same idea, and now I want to use their libraries.  (some of them in my company, some of them not.)</div><div><br></div><div>And now we’re stuck, because everyone is trying to make up for the same (perceived) lack and everyone wants them public so that they don’t have to keep sticking them in each library they write.</div><div><br></div><div>This is not a made up situation: many people even within one company trying to share code somewhat informally are going to write the same code to make using CGPoint/Size/Rect easier, and now we can’t share anything safely.</div><div><br></div><div>Anybody got some good ideas what to do about this?</div><div><br></div><div>[Same question could apply to adding extensions.]</div><div><br></div></div><br>______________________________<wbr>_________________<br>
swift-users mailing list<br>
<a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-users" rel="noreferrer" target="_blank">https://lists.swift.org/mailma<wbr>n/listinfo/swift-users</a><br>
<br></blockquote></div><br></div>
</div></blockquote></div><br></div></blockquote></div><br></div>