<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 Jan 4, 2016, at 12:40 PM, Douglas Gregor &lt;<a href="mailto:dgregor@apple.com" class="">dgregor@apple.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" class=""><div class=""><br class="Apple-interchange-newline">On Jan 4, 2016, at 10:30 AM, Matthew Johnson &lt;<a href="mailto:matthew@anandabits.com" class="">matthew@anandabits.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class=""><br class="Apple-interchange-newline">On Jan 4, 2016, at 12:21 PM, Douglas Gregor 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=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jan 3, 2016, at 4:19 PM, David Waite &lt;<a href="mailto:david@alkaline-solutions.com" class="">david@alkaline-solutions.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class="">This would be wonderful - is it something that could happen in the Swift 3 timeframe?</div></div></div></blockquote><div class=""><br class=""></div><div class="">I hesitate to say “yes” here. I think it fits with the goals of Swift 3, but my main concern is that there isn’t enough engineering bandwidth to implement it for Swift 3.</div><div class=""><br class=""></div><blockquote type="cite" class=""><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class="">Is it something that myself or someone else could work on a formal proposal for?</div></div></div></blockquote><div class=""><br class=""></div><div class="">Yes, absolutely. This is a case where I think it’s useful to design what we want, even if we cannot fit the implementation into the Swift 3 schedule. It’s also a case where the compiler has a lot of the pieces already implemented (with some runtime bits landing soon), so the implementation should not be *that* hard and will likely not require architectural changes.</div></div></div></div></blockquote><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Interesting. &nbsp;I was under the impression the core team was taking on the generics features.<span class="Apple-converted-space">&nbsp;</span></div></div></blockquote><div class=""><br class=""></div><div class="">We are, and lots of them. I doubt we can handle another.</div><br class=""><blockquote type="cite" class=""><div class=""><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">&nbsp;I am also very interested in helping to accelerate the process if that is possible (whether that means Swift 3 or not).</div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Are you thinking specifically about unbound existentials like in your Equatable example or also partly / fully bound existentials such as SequenceType&lt;Generator.Element == Int&gt;?</div></div></blockquote><div class=""><br class=""></div><div class="">I was thinking mostly about the former. However, the latter is also a highly-requested feature [*] that complements this one, and I think it’s reasonable to discuss both together.</div><div class=""><br class=""></div><span class="Apple-tab-span" style="white-space: pre;">        </span>- Doug</div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">[*] And is often the underlying reason why developers ask for parameterized protocols.</div></div></blockquote><div><br class=""></div><div>Agree. &nbsp;The other primary motivation I know of for that request is something like ConvertibleTo&lt;T&gt; where you multiple conformances would be possible. &nbsp;</div><div><br class=""></div><div>I am familiar with the reasons why Swift is avoiding that path. :)</div><br class=""><blockquote type="cite" class=""><div class=""><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""><blockquote type="cite" class=""><div class=""><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class=""><br class=""></div><span class="Apple-tab-span" style="white-space: pre;">        </span>- Doug</div><div class=""><br class=""><blockquote type="cite" class=""><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><br class=""></div><div class="">-DW</div><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jan 3, 2016, at 4:17 PM, Douglas Gregor 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=""><div dir="auto" class=""><div class=""><span class=""></span></div><div class=""><br class=""><div class="" style="direction: ltr;"><blockquote type="cite" class=""><div class="">On Jan 3, 2016, at 6:48 AM, Антон Жилин 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=""><div dir="ltr" class=""><div class="" style="font-size: 12.8px;">Introduction of interfaces will clean up the current blend of static and dynamic protocols, and solve at least three popular issues.</div><div class="" style="font-size: 12.8px;">Please see:</div><div class="" style="font-size: 12.8px;"><a href="https://github.com/Anton3/swift-evolution/blob/master/proposals/0000-introducing-interfaces.md" class="">https://github.com/Anton3/swift-evolution/blob/master/proposals/0000-introducing-interfaces.md</a></div></div></div></blockquote><div class="" style="direction: ltr;"><br class=""></div>I am *completely* against this proposal.</div><div class="" style="direction: ltr;"><br class=""></div><div class="" style="direction: ltr;">Fundamentally, you're trying to address the limitation that protocols with Self or associated type requirements can't be existential. But it's just a limitation that isn't (conceptually) that hard to fix: the primary operation you need to work with an existing of such a protocol is to "open" a value of existential type, giving a name to the dynamic type it stores. Let's invent one:</div><div class="" style="direction: ltr;"><br class=""></div><div class="" style="direction: ltr;">&nbsp; func eq(x: Equatable, y: Equatable) -&gt; Bool {</div><div class="" style="direction: ltr;">&nbsp; &nbsp; // give the name T to the dynamic type stored in xT</div><div class="" style="direction: ltr;">&nbsp; &nbsp; let xT = open x as T</div><div class="" style="direction: ltr;">&nbsp; &nbsp; // is y also storing a T?</div><div class="" style="direction: ltr;">&nbsp; &nbsp; guard let yT = y as? T else { return false }</div><div class="" style="direction: ltr;">&nbsp; &nbsp; // check whether the Ts are equal</div><div class="" style="direction: ltr;">&nbsp; &nbsp; return xT == yT</div><div class="" style="direction: ltr;">&nbsp; }</div><div class="" style="direction: ltr;"><br class=""></div><div class="" style="direction: ltr;">Ignore the syntax: semantically, we've gone from a "dynamic" existential thing back to something more "static", just by giving a name to the type. Swift generics aren't really even static in any sense: what the do is give names to the types of values so one can establish relationships among different values. "open..as" would do that for existentials.&nbsp;</div><div class="" style="direction: ltr;"><br class=""></div><div class="" style="direction: ltr;">Note that ether Swift compilers AST and SIL both have "open existential" operations that do this internally. They have no spelling in Swift code, but they are useful to describe operations on existentials. At present, they cannot be formed when the existential involves a protocol with Self or associated type requirements, but that's a limitation that isn't hard to address.&nbsp;</div><div class="" style="direction: ltr;"><br class=""></div><div class="" style="direction: ltr;">As for your concerns about knowing when one can dynamically override and when one cannot... &nbsp;There are issues here that need to be addressed. They aren't significant enough to warrant such a drastic change, and may not even require language changes at all.&nbsp;</div><div class="" style="direction: ltr;"><br class=""></div><div class="" style="direction: ltr;"><span class="Apple-tab-span" style="white-space: pre;">        </span>- Doug</div><div class="" style="direction: ltr;"><br class=""></div><div class="" style="direction: ltr;"><br class=""></div></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=nE9rxSXA5G4kxsTVkgv43vFcOQoCM-2FU-2BigXPSqPoICLQMF0Is2N1gVcYyd8LXauWU01V8ADskXgeA1dZAXS87kb5mrtSnua8ix3PvTqk8IjbkCFnioGdyq-2BKvhwvXwvyetVprM5QJNhgoafyPtUnsoK0Jd9PVrhUVERURHcV29O9ap7P5ZtW-2FOxTbxXomN8xjYwI10z8Hb2x7y5-2BqncZc5sWcNEbG-2B6FFuGHrYPzWeE-3D" alt="" width="1" height="1" border="0" class="" style="height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;"></div>_______________________________________________<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" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class=""></div></div></blockquote></div><br class=""><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=eLFMrKDT8iBxZ-2Fbnk-2BZqvSchNN-2FvYXdceA0T7VxwkAdMXbWL3n6mHRBUm-2F6PUtPD-2FljlyGTuXPkUEC1a-2FTOC6D9gx5ImQ6drfd6gcOK0qiM-2BAX3R82OKNqv0HIIcGLhdB8Iq-2FfeUIcQEtgexpBOVTv7OJyDjgfIuOcRwbT-2BOqE3oPWc4fWsEUjb9139vNqzlR69DaO2lXywo-2F0oAJuPGy0ESQRAn4c7AYwc5h6R2JpY-3D" alt="" width="1" height="1" border="0" class="" style="height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;"></div>_______________________________________________<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" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div></blockquote></div></div></blockquote></div><br class=""></body></html>