<html><body><div><br></div><div><br>Am 10. Mai 2016 um 20:11 schrieb Matthew Johnson <matthew@anandabits.com>:<br><br><div><blockquote type="cite"><div class="msg-quote"><div class="_stretch"><span class="body-text-content"><br><br>Sent from my iPad<br><br><blockquote type="cite" class="quoted-plain-text">On May 10, 2016, at 12:59 PM, Thorsten Seitz <tseitz42@icloud.com> wrote:</blockquote><blockquote type="cite" class="quoted-plain-text"><br></blockquote><blockquote type="cite" class="quoted-plain-text"><br></blockquote><blockquote type="cite" class="quoted-plain-text"><blockquote type="cite" class="quoted-plain-text">Am 10.05.2016 um 18:41 schrieb Timothy Wood via swift-evolution <swift-evolution@swift.org>:</blockquote></blockquote><blockquote type="cite" class="quoted-plain-text"><blockquote type="cite" class="quoted-plain-text"><br></blockquote></blockquote><blockquote type="cite" class="quoted-plain-text"><blockquote type="cite" class="quoted-plain-text"><br></blockquote></blockquote><blockquote type="cite" class="quoted-plain-text"><blockquote type="cite" class="quoted-plain-text"><blockquote type="cite" class="quoted-plain-text">On May 10, 2016, at 9:28 AM, Matthew Johnson <matthew@anandabits.com> wrote:</blockquote></blockquote></blockquote><blockquote type="cite" class="quoted-plain-text"><blockquote type="cite" class="quoted-plain-text"><blockquote type="cite" class="quoted-plain-text">Yep, understood. It's perfectly clear to me but I understand why Chris is concerned about it having potential to confuse people. It is a pretty subtle difference especially since Self and #Self are the same in some contexts. In any case, I would be content to live with any name that wins out.</blockquote></blockquote></blockquote><blockquote type="cite" class="quoted-plain-text"><blockquote type="cite" class="quoted-plain-text"><br></blockquote></blockquote><blockquote type="cite" class="quoted-plain-text"><blockquote type="cite" class="quoted-plain-text">Ah, OK -- it sounds like we just differ on what would be least confusing =)</blockquote></blockquote><blockquote type="cite" class="quoted-plain-text"><blockquote type="cite" class="quoted-plain-text"><br></blockquote></blockquote><blockquote type="cite" class="quoted-plain-text"><blockquote type="cite" class="quoted-plain-text">The other proposed name of #StaticSelf, seems like it would be very clear (if a bit redundant and longer than needed, once you’ve come across it once or twice). I could certainly live with #StaticSelf.</blockquote></blockquote><blockquote type="cite" class="quoted-plain-text"><br></blockquote><blockquote type="cite" class="quoted-plain-text">In that case StaticSelf would be sufficient IMHO. The # should only be needed to distinguish between Self and #Self.</blockquote><blockquote type="cite" class="quoted-plain-text"><br></blockquote><blockquote type="cite" class="quoted-plain-text">So:</blockquote><blockquote type="cite" class="quoted-plain-text"><br></blockquote><blockquote type="cite" class="quoted-plain-text">Self, #Self</blockquote><blockquote type="cite" class="quoted-plain-text">Self, StaticSelf</blockquote><blockquote type="cite" class="quoted-plain-text">DynamicSelf, StaticSelf</blockquote><blockquote type="cite" class="quoted-plain-text"><br></blockquote><blockquote type="cite" class="quoted-plain-text"><br></blockquote><blockquote type="cite" class="quoted-plain-text">As far as I understand #Self should be the type of the implementor (ImplementorSelf?) or conforming type (ConformingSelf?).</blockquote><blockquote type="cite" class="quoted-plain-text">How would this work with default methods?</blockquote><blockquote type="cite" class="quoted-plain-text"><br></blockquote><blockquote type="cite" class="quoted-plain-text">protocol A {</blockquote><blockquote type="cite" class="quoted-plain-text">func f() -> #Self</blockquote><blockquote type="cite" class="quoted-plain-text">init()</blockquote><blockquote type="cite" class="quoted-plain-text">}</blockquote><blockquote type="cite" class="quoted-plain-text"><br></blockquote><blockquote type="cite" class="quoted-plain-text">extension A {</blockquote><blockquote type="cite" class="quoted-plain-text">func f() -> #Self { return init() } // what type has #Self here?</blockquote><blockquote type="cite" class="quoted-plain-text">}</blockquote><br>The conforming type. C in your example. If we have 'class D: C' and it overrides 'f' the override would have a return type of C, not D. The returned instance could be of type D since it is a subtype of C. We could also explore allowing overrides to have a covariant return type, it just wouldn't be visible when accessed via the protocol through a generic constraint or an existential (those would only guarantee C, the type that declared the conformance.</span></div></div></blockquote></div><div><span><br data-mce-bogus="1"></span></div><div><span>Thanks, that makes sense. </span></div><div><span>So within a default method like in extension A above the (concrete) type of #Self is still unknown and I only know that it will conform to A. That's fine. As soon as a non protocol type like a class conforms to the protocol #Self gets fixed to that type and because we have no multiple inheritance for non protocols there is no possibility to create conflicts.<br data-mce-bogus="1"></span></div><div><span><br data-mce-bogus="1"></span></div><div><span></span>-Thorsten</div></div></body></html>