<div dir="ltr">I Like this C#'s "Explicit Interface Implementation".<div>The cast to call is understandable, it's good, but just think about. If we use "self.Marriageable.ring" or "variable.Marriageable.ring" will make more symmetrical with the implementation? "dot protocol" can be used to all "explicit call", 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 <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> 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#'s "Explicit Interface Implementation" 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"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></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>> 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>
><br>
> protocol ForwardIndexType : _Incrementable {<br>
> @warn_unused_result<br>
> public func advancedBy(n: Self.Distance) -> Self<br>
> }<br>
><br>
> extension ForwardIndexType {<br>
> @warn_unused_result<br>
> public func advancedBy(n: Self.Distance) -> Self<br>
> @warn_unused_result<br>
> public func advancedBy(n: Self.Distance, limit: Self) -> Self<br>
> @warn_unused_result<br>
> public func distanceTo(end: Self) -> Self.Distance<br>
> }<br>
><br>
> protocol BidirectionalIndexType : ForwardIndexType<br>
> extension BidirectionalIndexType {<br>
> @warn_unused_result<br>
> public func advancedBy(n: Self.Distance) -> Self<br>
> @warn_unused_result<br>
> public func advancedBy(n: Self.Distance, limit: Self) -> Self<br>
> }<br>
<br>
</span>Firstly, for methods and subscriptors the "name" 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`'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) -> Self` methods and it'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>