<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="">Am 27.05.2016 um 10:45 schrieb Austin Zheng &lt;<a href="mailto:austinzheng@gmail.com" class="">austinzheng@gmail.com</a>&gt;:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">As far as I understand it (and the core team as well, judging from their posts), an existential is just a type defined by an interface of some sort ("there exists a type that is capable of X, Y, and Z"), and you can put any value of a type that meets that interface in the existential. </div></div></blockquote><div><br class=""></div><div>Yeah, that is an unfortunate issue with the use of "existential“ in Swift as opposed to its use elsewhere (e.g. Wikipedia, Haskell).</div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">The associated types/self types requirements are non-essential add-ons.</div></div></blockquote><div><br class=""></div><div>But these are what makes the new construct necessary in the first place. Because currently protocols with such requirements can only be used as constraints in generics and not as types.</div><div>To make them usable elsewhere is a feature of writing `any&lt;P&gt;` which is an existential type like defined outside of Swift in Wikipedia or Haskell, i.e. a type with an unbound type parameter.&nbsp;</div><div>(An alternative to having to use `any&lt;&gt;` would to make this interpretation as existential implicit and allow adding constraints by a following `where`).</div><div><br class=""></div><div>That’s why I would like to either</div><div>- restrict `any&lt;…&gt;` to only protocols with unbound associated types or self type requirements</div><div>- allow `any&lt;T&gt;` for all protocols and classes, where this just means `any&lt;T&gt;` == `T` iff T has no unbound associated types or self requirements</div><div>- do away with `any&lt;…&gt;` altogether and automatically interpret `P` as an existential when used as a type and use `P &amp; Q` instead of `any&lt;P, Q&gt;`</div><div><br class=""></div><div>-Thorsten</div><div><br class=""></div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""></div><div class="">I am about to fall asleep, though, so I'd be happy to reread the article tomorrow and if I'm wrong, make the change.</div><div class=""><br class=""></div><div class="">Austin<br class=""><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On May 27, 2016, at 1:42 AM, Thorsten Seitz &lt;<a href="mailto:tseitz42@icloud.com" class="">tseitz42@icloud.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">Am 27.05.2016 um 10:30 schrieb Austin Zheng &lt;<a href="mailto:austinzheng@gmail.com" class="">austinzheng@gmail.com</a>&gt;:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Thank you for all your great feedback!</div><div class=""><br class=""></div><div class="">Let me try rephrasing what I said, because it wasn't very clear. Apologies.</div><div class=""><br class=""></div><div class="">NSView is not an existential, like you said.</div><div class=""><br class=""></div><div class="">Any&lt;...&gt; syntax is, as far as we've seen, always used for existential types.</div><div class=""><br class=""></div><div class="">"Any&lt;NSView&gt;" *looks* like an existential because it has the "Any&lt;...&gt;" syntax, but if it's a synonym for just "NSView" then it actually isn't an existential.</div><div class=""><br class=""></div><div class="">So "Any&lt;NSView&gt;" isn't an existential, but it looks like one. This is something I think would be confusing to a lot of people, and also redundant: there is no reason as far as I know to ever write Any&lt;SomeClass&gt; when you could just write SomeClass, so by banning the confusing form we don't lose any expressive power.</div></div></div></blockquote><div class=""><br class=""></div>Ah, ok! So `Any&lt;NSView&gt;` is just the same as `NSView`. That’s my understanding as well :-)</div><div class=""><br class=""></div><div class="">But this does not apply only to classes: `Any&lt;CustomStringConvertible&gt;` is just the same as `CustomStringConvertible`, too, because `CustomStringConvertible` does not have associated types or self type requirements (it is *not* an existential in Wikipedia’s sense).</div><div class=""><br class=""></div><div class="">Banning `Any&lt;Foo&gt;` where `Foo` does not have associated types or self type requirements would be the right thing to do, I think, regardless whether `Foo` is a class or a protocol. This would make it clear that `Any&lt;Foo&gt;` is a *real* existential.&nbsp;</div><div class=""><br class=""></div><div class="">-Thorsten</div><div class=""><br class=""></div><div class=""><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""></div><div class="">Hope that helps,</div><div class="">Austin</div><br class=""><div class=""><blockquote type="cite" class=""><div class="">On May 27, 2016, at 1:24 AM, Thorsten Seitz &lt;<a href="mailto:tseitz42@icloud.com" class="">tseitz42@icloud.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-variant-caps: 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">Am 26.05.2016 um 22:44 schrieb Austin Zheng via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt;:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">(inline)<br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Thu, May 26, 2016 at 12:22 PM, David Hart<span class="Apple-converted-space">&nbsp;</span><span dir="ltr" class="">&lt;<a href="mailto:david@hartbit.com" target="_blank" class="">david@hartbit.com</a>&gt;</span><span class="Apple-converted-space">&nbsp;</span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div class="" style="word-wrap: break-word;">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></blockquote><div class=""><br class=""></div><div class="">Thank you! I just hope a proposal like this one ends up being good enough that it means less work for the core team, not more...</div><div class="">&nbsp;</div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div class="" style="word-wrap: break-word;"><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 class="" style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; background-color: rgba(0, 0, 0, 0.0392157);">Any&lt;&gt;</span>&nbsp;and&nbsp;<span class="" style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; background-color: rgba(0, 0, 0, 0.0392157);">Any&lt;NSView&gt;</span>&nbsp;be illegal? What error messages would they generate? Why not make them simply&nbsp;synonymous to&nbsp;<span class="" style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; background-color: rgba(0, 0, 0, 0.0392157);">Any</span>, and&nbsp;<span class="" style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; background-color: rgba(0, 0, 0, 0.0392157);">NSView</span>, the same way&nbsp;<span class="" style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; background-color: rgba(0, 0, 0, 0.0392157);">protocol&lt;&gt;</span>&nbsp;currently behaves?</div></div></blockquote><div class=""><br class=""></div><div class="">"Any&lt;&gt;" being illegal is a syntactic battle that is being fought over in a different thread; I'm not personally invested one way or another. (We might not even adopt "Any" syntax specifically; Joe Groff has ideas for a different syntax that doesn't use the brackets.)</div><div class=""><br class=""></div><div class="">"Any&lt;NSView&gt;" is an existential, and "NSView" isn't. Existentials' metatypes are different from the metatypes of concrete types, and the ways they can be used with generics is different as well. My opinion is that Any&lt;...&gt; signifies an existential, and allowing the use of "Any&lt;SomeClass&gt;" as a concrete type would just confuse people even more.</div></div></div></div></div></blockquote><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: 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-caps: 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-caps: 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="">This is something where I still have a problem understanding what an existential is in the Swift sense. In the "normal“ sense (as defined in Wikipedia or Haskell) NSView cannot be an existential because it has no unbound associated types. It cannot be just made an existential either. How would that work?</div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: 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-caps: 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="">So, what is the meaning of `Any&lt;NSView&gt;` being an existential? How is that type different from the type `NSView`?</div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: 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-caps: 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="">-Thorsten</div></div></blockquote></div><br class=""></div></div></blockquote></div><br class=""></div></div></blockquote></div><br class=""></div></div></div></div></blockquote></div><br class=""></body></html>