<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 21, 2017, at 11:42 PM, David Hart via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div dir="auto" class=""><div class="">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 class=""><br class=""></div></div></div></blockquote><div><br class=""></div>It’s unlikely we’ll make it a priority to implement anything like that in the Swift 4 timeframe, but PRs are more than welcome ;-)</div><div><br class=""></div><div>Slava</div><div><br class=""><blockquote type="cite" class=""><div class=""><div dir="auto" class=""><div class="">On 22 Feb 2017, at 08:36, Douglas Gregor &lt;<a href="mailto:dgregor@apple.com" class="">dgregor@apple.com</a>&gt; wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div class=""><br class=""><br class="">Sent from my iPhone</div><div class=""><br class="">On Feb 21, 2017, at 11:25 PM, David Hart via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div class="">Yes, but it's not very discoverable. Plus, if the subclass existentials proposal is accepted, it would actually allow us to do:</div><div class=""><br class=""></div><div class="">class C {}</div><div class="">extension C &amp; P1 {}</div></div></blockquote><div class=""><br class=""></div>... which is&nbsp;<div class=""><br class=""></div><div class="">extension P1 where Self: C1 {}</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">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 class=""><br class=""></div><div class="">&nbsp; - Doug</div><div class=""><br class=""><blockquote type="cite" class=""><div class=""><div class=""><br class="">On 22 Feb 2017, at 08:06, Jacob Bandes-Storch &lt;<a href="mailto:jtbandes@gmail.com" class="">jtbandes@gmail.com</a>&gt; wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><div dir="ltr" class="">This works today:<div class=""><br class=""></div><div class=""><div class="">protocol P1{}</div><div class="">protocol P2{}</div><div class=""><br class=""></div><div class="">extension P1 where Self: P2 {</div><div class="">&nbsp; &nbsp; func foo() {}</div><div class="">}</div><div class=""><br class=""></div><div class="">func bar(x: P1 &amp; P2) {</div><div class="">&nbsp; &nbsp; x.foo()</div><div class="">}</div></div><div class=""><br class=""></div><div class="gmail_extra">
<br class=""><div class="gmail_quote">On Tue, Feb 21, 2017 at 10:53 PM, David Hart via swift-evolution <span dir="ltr" class="">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt;</span> wrote:<br class=""><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" class="">Hello list,<div class=""><br class=""></div><div class="">Found out yesterday that you can’t extend all existentials in Swift:</div><div class=""><br class=""></div><div class=""><font face="Menlo" class="">protocol P1 {}</font></div><div class=""><font face="Menlo" class="">extension P1 {}</font></div><div class=""><font face="Menlo" class="">// works as expected</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class="">protocol P2 {}</font></div><div class=""><font face="Menlo" class="">extension P1 &amp; P2 {}</font></div><div class=""><font face="Menlo" class="">// error: non-nominal type 'P1 &amp; P2' cannot be extended</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class="">extension&nbsp;Any&nbsp;{}</font></div><div class=""><font face="Menlo" class="">//&nbsp;error: non-nominal type 'Any' cannot be extended</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class="">extension&nbsp;AnyObject&nbsp;{}</font></div><div class=""><font face="Menlo" class="">//&nbsp;error: 'AnyObject' protocol cannot be extended</font></div><div class=""><br class=""></div><div class="">I’d like to write a proposal to lift some of those restrictions. But the question is: which should be lifted? <font face="Menlo" class="">P1 &amp; P2</font> seems like an obvious case. But what about <font face="Menlo" class="">Any</font> and <font face="Menlo" class="">AnyObject</font>? Is there a design reason that we shouldn’t allow it?</div><span class="gmail-HOEnZb"><font color="#888888" class=""><div class=""><br class=""></div><div class="">David.</div></font></span></div><br class="">______________________________<wbr class="">_________________<br class="">
swift-evolution mailing list<br class="">
<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/<wbr class="">mailman/listinfo/swift-<wbr class="">evolution</a><br class="">
<br class=""></blockquote></div><br class=""></div></div>
</div></blockquote></div></blockquote><blockquote type="cite" class=""><div class=""><span class="">_______________________________________________</span><br class=""><span class="">swift-evolution mailing list</span><br class=""><span class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a></span><br class=""><span class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br class=""></div></blockquote></div></div></blockquote></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></body></html>