<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>If we drop the idea of extending Any and AnyObject (which is out of scope), does the fact that what is left is syntactic sugar make it unsuitable for Swift 4? I remember Chris saying syntactic sugar is not the goal for Swift 4, but this syntactic sugar looks really sweet (pun intended).</div><div><br>On 22 Feb 2017, at 08:36, Douglas Gregor &lt;<a href="mailto:dgregor@apple.com">dgregor@apple.com</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div><br><br>Sent from my iPhone</div><div><br>On Feb 21, 2017, at 11:25 PM, David Hart via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div>Yes, but it's not very discoverable. Plus, if the subclass existentials proposal is accepted, it would actually allow us to do:</div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">class C {}</div><div id="AppleMailSignature">extension C &amp; P1 {}</div></div></blockquote><div><br></div>... which is&nbsp;<div><br></div><div>extension P1 where Self: C1 {}</div><div><br></div><div><br></div><div>Actually extending semantics (e.g. to extend Any or AnyObject) is a very large project that's out of scope. Without that, this is a small bit of syntactic sugar.&nbsp;</div><div><br></div><div>&nbsp; - Doug</div><div><br><blockquote type="cite"><div><div><br>On 22 Feb 2017, at 08:06, Jacob Bandes-Storch &lt;<a href="mailto:jtbandes@gmail.com">jtbandes@gmail.com</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr">This works today:<div><br></div><div><div>protocol P1{}</div><div>protocol P2{}</div><div><br></div><div>extension P1 where Self: P2 {</div><div>&nbsp; &nbsp; func foo() {}</div><div>}</div><div><br></div><div>func bar(x: P1 &amp; P2) {</div><div>&nbsp; &nbsp; x.foo()</div><div>}</div></div><div><br></div><div class="gmail_extra">
<br><div class="gmail_quote">On Tue, Feb 21, 2017 at 10:53 PM, David Hart 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><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word">Hello list,<div><br></div><div>Found out yesterday that you can’t extend all existentials in Swift:</div><div><br></div><div><font face="Menlo">protocol P1 {}</font></div><div><font face="Menlo">extension P1 {}</font></div><div><font face="Menlo">// works as expected</font></div><div><font face="Menlo"><br></font></div><div><font face="Menlo">protocol P2 {}</font></div><div><font face="Menlo">extension P1 &amp; P2 {}</font></div><div><font face="Menlo">// error: non-nominal type 'P1 &amp; P2' cannot be extended</font></div><div><font face="Menlo"><br></font></div><div><font face="Menlo">extension&nbsp;Any&nbsp;{}</font></div><div><font face="Menlo">//&nbsp;error: non-nominal type 'Any' cannot be extended</font></div><div><font face="Menlo"><br></font></div><div><font face="Menlo">extension&nbsp;AnyObject&nbsp;{}</font></div><div><font face="Menlo">//&nbsp;error: 'AnyObject' protocol cannot be extended</font></div><div><br></div><div>I’d like to write a proposal to lift some of those restrictions. But the question is: which should be lifted? <font face="Menlo">P1 &amp; P2</font> seems like an obvious case. But what about <font face="Menlo">Any</font> and <font face="Menlo">AnyObject</font>? Is there a design reason that we shouldn’t allow it?</div><span class="gmail-HOEnZb"><font color="#888888"><div><br></div><div>David.</div></font></span></div><br>______________________________<wbr>_________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br>
<br></blockquote></div><br></div></div>
</div></blockquote></div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></div></div></blockquote></body></html>