<div dir="ltr">I Like this C#&#39;s &quot;Explicit Interface Implementation&quot;.<div>The cast to call is understandable, it&#39;s good, but just think about. If we use &quot;self.Marriageable.ring&quot; or &quot;variable.Marriageable.ring&quot; will make more symmetrical with the implementation? &quot;dot protocol&quot; can be used to all &quot;explicit call&quot;, ambiguous or not.</div></div><br><div class="gmail_quote"><div dir="ltr">Em dom, 10 de jan de 2016 às 21:49, Andrew Bennett via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; escreveu:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Sorry if this is already mentioned, but I quite like C#&#39;s &quot;Explicit Interface Implementation&quot; approach:<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><a href="https://msdn.microsoft.com/en-us/library/ms173157.aspx" target="_blank">https://msdn.microsoft.com/en-us/library/ms173157.aspx</a></div></blockquote><br>Basically:<font face="monospace, monospace"><br></font><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"></blockquote></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><span style="font-family:monospace,monospace">var Marriageable.ring: String? { ... }</span><br><font face="monospace, monospace">var CallReceivable.ring: String? { ... }<br><br></font></blockquote><span style="font-family:arial,helvetica,sans-serif">to call it you could do </span><font face="monospace, monospace">self.ring</font><span style="font-family:arial,helvetica,sans-serif"> if it was unambiguous, otherwise:</span><br><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><font face="monospace, monospace"> (self as Marriageable).ring<br></font><span style="font-family:monospace,monospace">(self as </span><span style="font-family:monospace,monospace">CallReceivable</span><span style="font-family:monospace,monospace">).ring</span><font face="monospace, monospace"><br></font></blockquote><font face="monospace, monospace"><br></font></div><div class="gmail_extra"><br><div class="gmail_quote"></div></div><div class="gmail_extra"><div class="gmail_quote">On Mon, Jan 11, 2016 at 9:51 AM, Brent Royal-Gordon via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br></div></div><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"><span>&gt; By giving warning simply for same name, it will be quite annoying when the project run into this situation without any wrong. For example:<br>
&gt;<br>
&gt; protocol ForwardIndexType : _Incrementable {<br>
&gt;     @warn_unused_result<br>
&gt;     public func advancedBy(n: Self.Distance) -&gt; Self<br>
&gt; }<br>
&gt;<br>
&gt; extension ForwardIndexType {<br>
&gt;     @warn_unused_result<br>
&gt;     public func advancedBy(n: Self.Distance) -&gt; Self<br>
&gt;     @warn_unused_result<br>
&gt;     public func advancedBy(n: Self.Distance, limit: Self) -&gt; Self<br>
&gt;     @warn_unused_result<br>
&gt;     public func distanceTo(end: Self) -&gt; Self.Distance<br>
&gt; }<br>
&gt;<br>
&gt; protocol BidirectionalIndexType : ForwardIndexType<br>
&gt; extension BidirectionalIndexType {<br>
&gt;     @warn_unused_result<br>
&gt;     public func advancedBy(n: Self.Distance) -&gt; Self<br>
&gt;     @warn_unused_result<br>
&gt;     public func advancedBy(n: Self.Distance, limit: Self) -&gt; Self<br>
&gt; }<br>
<br>
</span>Firstly, for methods and subscriptors the &quot;name&quot; would actually encompass the entire signature, so `advancedBy(_:)` and `advancedBy(_:limit:)` would not conflict because they have different signatures.<br>
<br>
Secondly, `ForwardIndexType` and `BidirectionalIndexType` are *not* unrelated protocols—one of them conforms to the other. Thus, we can assume that `BidirectionalIndexType` knows about `ForwardIndexType`&#39;s `advancedBy` methods and intends for its versions to have compatible semantics.<br>
<br>
If instead `BidirectionalIndexType` did *not* conform to `ForwardIndexType`, and `RandomAccessIndexType` tried to conform to both `ForwardIndexType` and `BidirectionalIndexType`, *then* we would get an error, because two independent protocols would have declared `advancedBy(_: Self.Distance) -&gt; Self` methods and it&#39;s possible they meant for them to have different semantics.<br>
</blockquote></div></div><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><div><br>
--<br>
Brent Royal-Gordon<br>
Architechies<br>
<br></div></div></blockquote></div></div><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><div>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</div></div></blockquote></div></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=fuWmDRE6-2FDdvdUHeLHruUfdigJaxz7nh99l6HfkulY-2FkWmfrhbhT3xlXsc55h4FBPq4CjAb7ELALJ6Q8Reb8pkZjFKdqDOxzJSF-2BUKBAQj5HkbRvC6eIMhGU7gJEGd-2BzeaMtdogVxtPweDtD8L3ZDAbHmN7ZWAPQEXoplRRIE8-2F-2BFQqky1H6gjPiznqaTtT7MyEwhJamM8rSCIu1dEQI4aw2kmDvWuGaJnwjHngn8mc-3D" alt="" width="1" height="1" border="0" style="min-height:1px!important;width:1px!important;border-width:0!important;margin-top:0!important;margin-bottom:0!important;margin-right:0!important;margin-left:0!important;padding-top:0!important;padding-bottom:0!important;padding-right:0!important;padding-left:0!important">
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</blockquote></div>