<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="">Hi Austin,<div class=""><br class=""></div><div class="">I never had te occasion to say thanks for the work you have put in this proposal, so thanks! I’m really looking forward to be able to have some form of it accepted and implemented in Swift.</div><div class=""><br class=""></div><div class="">Here are a few comments:</div><div class=""><br class=""></div><div class="">1) Why would&nbsp;<span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; background-color: rgba(0, 0, 0, 0.0392157);" class="">Any&lt;&gt;</span>&nbsp;and&nbsp;<span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; background-color: rgba(0, 0, 0, 0.0392157);" class="">Any&lt;NSView&gt;</span>&nbsp;be illegal? What error messages would they generate? Why not make them simply&nbsp;synonymous to&nbsp;<span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; background-color: rgba(0, 0, 0, 0.0392157);" class="">Any</span>, and&nbsp;<span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; background-color: rgba(0, 0, 0, 0.0392157);" class="">NSView</span>, the same way&nbsp;<span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; background-color: rgba(0, 0, 0, 0.0392157);" class="">protocol&lt;&gt;</span>&nbsp;currently behaves?</div><div class=""><br class=""></div><div class="">2) You say that "An&nbsp;<span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; background-color: rgba(0, 0, 0, 0.0392157);" class="">Any&lt;...&gt;</span>&nbsp;existential can have zero or one&nbsp;where&nbsp;clauses, <b class="">following the list of requirements.</b>” This seems to be contradicted in two places:</div><div class=""><br class=""></div><div class="">In the example under <b class="">Nested&nbsp;<span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; background-color: rgba(0, 0, 0, 0.0392157);" class="">Any&lt;...&gt;</span></b>, which should probably be edited to:</div><div class=""><br class=""></div><div class=""><pre style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; margin-top: 0px; margin-bottom: 0px; line-height: 1.45; word-wrap: normal; padding: 16px; overflow: auto; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-break: normal; color: rgb(51, 51, 51);" class=""><span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">// NOT ALLOWED</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">// This is impossible to fufill. A collection's elements cannot be both strings</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">// and integers at the same time.</span>
<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">let</span> a <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">:</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Any</span><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">&lt;</span>Collection, <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Any</span><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">&lt;</span>Collection <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">where</span> Collection<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span>Element <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">==</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Int</span><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">&gt;&nbsp;</span><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">where</span> Collection<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span>Element <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">==</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">String</span><span style="color: rgb(167, 29, 93);" class="">&gt;</span></pre><div class=""><br class=""></div></div><div class="">In the&nbsp;<b class=""><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; background-color: rgba(0, 0, 0, 0.0392157);" class="">where</span>&nbsp;clause</b>&nbsp;section, you say:</div><div class=""><br class=""></div><div class=""><span style="color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class="">Associated types used within the&nbsp;</span><code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; color: rgb(51, 51, 51);" class="">where</code><span style="color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class="">&nbsp;clause must belong to the protocols in the current or previous requirements.</span></div><div class=""><br class=""></div><div class="">This sounds a bit bizarre because where clauses always appear at the end, so there is no such “current” requirements and all requirements are “previous”.</div><div class=""><br class=""></div><div class="">I still have to take the time to finish digesting the end of the proposal.</div><div class=""><br class=""></div><div class="">David.</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 26 May 2016, at 07:53, Austin Zheng 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="">The inimitable Joe Groff provided me with an outline as to how the design could be improved. I've taken the liberty of rewriting parts of the proposal to account for his advice.<div class=""><br class=""></div><div class="">It turns out the runtime type system is considerably more powerful than I expected. The previous concept in which protocols with associated types' APIs were vended out selectively and using existentials has been discarded.</div><div class=""><br class=""></div><div class="">Instead, all the associated types that belong to an existential are accessible as 'anonymous' types within the scope of the existential. These anonymous types are not existentials - they are an anonymous representation of whatever concrete type is satisfying the existential's value's underlying type's associated type.</div><div class=""><br class=""></div><div class="">This is an enormous step up in power - for example, an existential can return a value of one of these anonymous associated types from one function and pass it into another function that takes the same type, maintaining perfect type safety but without ever revealing the actual type. There is no need anymore to limit the APIs exposed to the user, although there may still exist APIs that are semantically useless without additional type information.</div><div class=""><br class=""></div><div class="">A set of conversions has also been defined. At compile-time 'as' can be used to turn values of these anonymous associated types back into existentials based on the constraints defined earlier. 'as?' can also be used for conditional casting of these anonymously-typed values into potential actual types.</div><div class=""><br class=""></div><div class="">As always, the link is here, and feedback would be greatly appreciated:&nbsp;<a href="https://github.com/austinzheng/swift-evolution/blob/az-existentials/proposals/XXXX-enhanced-existentials.md" class="">https://github.com/austinzheng/swift-evolution/blob/az-existentials/proposals/XXXX-enhanced-existentials.md</a></div><div class=""><br class=""></div><div class="">Best,</div><div class="">Austin</div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, May 24, 2016 at 5:09 AM, Matthew Johnson 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br class="">
<br class="">
Sent from my iPad<br class="">
<span class=""><br class="">
On May 23, 2016, at 9:52 PM, Brent Royal-Gordon via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class="">
<br class="">
&gt;&gt; One initial bit of feedback -&nbsp; I believe if you have existential types, I believe you can define Sequence Element directly, rather than with a type alias. e.g.<br class="">
&gt;&gt;<br class="">
&gt;&gt; protocol Sequence {<br class="">
&gt;&gt;&nbsp; associatedtype Element<br class="">
&gt;&gt;&nbsp; associatedtype Iterator: any&lt;IteratorProtocol where IteratorProtocol.Element==Element&gt;<br class="">
&gt;&gt;&nbsp; associatedtype SubSequence: any&lt;Sequence where Sequence.Element == Element&gt;<br class="">
&gt;&gt;&nbsp; …<br class="">
&gt;&gt; }<br class="">
&gt;<br class="">
&gt; That's not really the same thing. Any&lt;IteratorProtocol&gt; is an existential, not a protocol. It's basically an automatically-generated version of our current `AnyIterator&lt;T&gt;` type (though with some additional flexibility). It can't appear on the right side of a `:`, any more than AnyIterator could.<br class="">
<br class="">
</span>After this proposal you should be able to use these existentials anywhere you can place a constraint, so it would work.&nbsp; You can do this with the protocol composition operator today and the future existential is just an extension of that capability.<br class="">
<span class="im HOEnZb"><br class="">
&gt;<br class="">
&gt; What *would* work is allowing `where` clauses on associated types:<br class="">
&gt;<br class="">
&gt;&gt; protocol Sequence {<br class="">
&gt;&gt;&nbsp; associatedtype Element<br class="">
&gt;&gt;&nbsp; associatedtype Iterator: IteratorProtocol where Iterator.Element==Element<br class="">
&gt;&gt;&nbsp; associatedtype SubSequence: Sequence where SubSequence.Element == Element<br class="">
&gt;&gt;&nbsp; …<br class="">
&gt;&gt; }<br class="">
&gt;<br class="">
&gt; I believe this is part of the generics manifesto.<br class="">
&gt;<br class="">
&gt; --<br class="">
&gt; Brent Royal-Gordon<br class="">
&gt; Architechies<br class="">
&gt;<br class="">
</span><div class="HOEnZb"><div class="h5">&gt; _______________________________________________<br class="">
&gt; swift-evolution mailing list<br class="">
&gt; <a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">
&gt; <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="">
<br 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/mailman/listinfo/swift-evolution</a><br class="">
</div></div></blockquote></div><br class=""></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=""></div></body></html>