<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><br></div><div>On 29 Jan 2017, at 23:12, Xiaodi Wu &lt;<a href="mailto:xiaodi.wu@gmail.com">xiaodi.wu@gmail.com</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr">On Sun, Jan 29, 2017 at 4:01 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><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div>Hi Matthew,</div><div><br></div><div>I’ll reply to this post, because it allows me to discuss a few of the points in the discussion, but I’ve read the whole discussion.</div><br><div><span class="gmail-"><blockquote type="cite"><div>On 29 Jan 2017, at 18:30, Matthew Johnson &lt;<a href="mailto:matthew@anandabits.com" target="_blank">matthew@anandabits.com</a>&gt; wrote:</div><br class="gmail-m_-4526869765988871141Apple-interchange-newline"><div><div style="word-wrap:break-word">Hi David,<div><br></div><div>This looks like a great start.</div><div><br></div><div>One thing we should consider is whether we tie this proposal so tightly to classes or whether it might be better to call these supertype constraints.&nbsp; The feature might also be useful for value types if / when Swift gets value subtyping.</div></div></div></blockquote><div><br></div></span><div>This makes sense, especially with the Substring : String discussions going on. When I rework the proposal, I’ll try to make it more general.</div><span class="gmail-"><br><blockquote type="cite"><div><div style="word-wrap:break-word"><div>One enhancement that might be worth considering.&nbsp; Specifically, allowing protocols to declare a specific supertype requirement in the place where a `class` constraint would usually be found.&nbsp; After this proposal we could already do something similar using a `class` constraint to define a protocol and a typealias to bind it to the supertype requirement.&nbsp; It seems like allowing users to state this more directly would be a good idea.</div></div></div></blockquote><div><br></div></span><div>You lost me there. Can you give examples?</div><span class="gmail-"><br><blockquote type="cite"><div><div style="word-wrap:break-word"><div><span style="color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px;background-color:rgb(255,255,255)">As only the first element in the existential composition syntax can be a class type, and by extending this rule to typealias expansions, we can make sure that we only need to read the first element to know if it contains a class requirement.</span></div><div><br></div><div>I think this is unnecessarily limiting in a couple of ways.&nbsp; I agree that a class should come first if it is mentioned explicitly***.&nbsp; I am less sure we should require this when the type is part of a typealias combined with other protocol requirements.</div></div></div></blockquote><div><br></div></span><div>I agree with Chris that I think it’s important to require the class be mentioned first when the class is mentioned explicitly. Even if we lost the Any&lt;Base, Protocol&gt; syntax, there is still enough similarity to a class’s inheritance/conformance clause to keep the consistency and readability.</div><span class="gmail-"><br><blockquote type="cite"><div><div style="word-wrap:break-word"><div>For example, one use case I remember discussing with Austin is refining supertype requirements.&nbsp; If I have a typealias which requires a superclass `Base` I should be able to form an existential using that typealias that *refines* that requirement to some type *Derived* which is a non-final subtype of `Base`.&nbsp; This would require syntax that allows us to put a class name in the first position, but also mention a typealias with a supertype requirement in a subsequent position.</div></div></div></blockquote><div><br></div></span><div>I’ve read the examples in the thread and I think I agree that those cases should be accepted. But just to make sure we are on the same page, what does everyone think of the validity of the following cases? For shorthand, I use parentheses to represent typealias expansion. For example, when I write:</div><div><br></div><div><pre style="box-sizing:border-box;overflow:auto;font-family:consolas,'liberation mono',menlo,courier,monospace;font-size:13.600000381469727px;margin-top:0px;margin-bottom:16px;line-height:1.45;padding:16px;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-wrap:normal;color:rgb(51,51,51)"><code class="gmail-m_-4526869765988871141language-swift" style="box-sizing:border-box;font-family:consolas,'liberation mono',menlo,courier,monospace;line-height:inherit;padding:0px;margin:0px;background-color:transparent;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-break:normal;border:0px;display:inline;word-wrap:normal"><span class="gmail-m_-4526869765988871141hljs-type" style="box-sizing:border-box;color:rgb(121,93,163)">Protocol1</span> &amp; (<span class="gmail-m_-4526869765988871141hljs-type" style="box-sizing:border-box;color:rgb(121,93,163)">Protocol2</span> &amp; <span class="gmail-m_-4526869765988871141hljs-type" style="box-sizing:border-box;color:rgb(121,93,163)">Protocol3</span>)</code></pre></div><div>I mean:</div><div><br></div><div><pre style="box-sizing:border-box;overflow:auto;font-family:consolas,'liberation mono',menlo,courier,monospace;font-size:13.600000381469727px;margin-top:0px;margin-bottom:16px;line-height:1.45;padding:16px;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-wrap:normal;color:rgb(51,51,51)"><code class="gmail-m_-4526869765988871141language-swift" style="box-sizing:border-box;font-family:consolas,'liberation mono',menlo,courier,monospace;line-height:inherit;padding:0px;margin:0px;background-color:transparent;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-break:normal;border:0px;display:inline;word-wrap:normal"><span class="gmail-m_-4526869765988871141hljs-keyword" style="box-sizing:border-box;color:rgb(167,29,93)">typealias</span> <span class="gmail-m_-4526869765988871141hljs-type" style="box-sizing:border-box;color:rgb(121,93,163)">Something</span> = <span class="gmail-m_-4526869765988871141hljs-type" style="box-sizing:border-box;color:rgb(121,93,163)">Protocol2</span> &amp; <span class="gmail-m_-4526869765988871141hljs-type" style="box-sizing:border-box;color:rgb(121,93,163)">Protocol3</span>
<span class="gmail-m_-4526869765988871141hljs-type" style="box-sizing:border-box;color:rgb(121,93,163)">Protocol1</span> &amp; <span class="gmail-m_-4526869765988871141hljs-type" style="box-sizing:border-box;color:rgb(121,93,163)">Something</span></code></pre></div><div><b>Questions</b></div><div><br></div><div><ol style="box-sizing:border-box;padding:0px 0px 0px 2em;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:'helvetica neue',helvetica,'segoe ui',arial,freesans,sans-serif;font-size:16px;background-color:rgb(255,255,255)"><li style="box-sizing:border-box">Should class requirements be fixed to first position? I.e., should&nbsp;<code style="box-sizing:border-box;font-family:consolas,'liberation mono',menlo,courier,monospace;font-size:13.600000381469727px;line-height:normal;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">Protocol &amp; Base</code>&nbsp;be valid and equivalent to&nbsp;<code style="box-sizing:border-box;font-family:consolas,'liberation mono',menlo,courier,monospace;font-size:13.600000381469727px;line-height:normal;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">Base &amp; Protocol</code>?</li><li style="box-sizing:border-box">Should repetition of class requirements in the same declaration be allowed? I.e., should&nbsp;<code style="box-sizing:border-box;font-family:consolas,'liberation mono',menlo,courier,monospace;font-size:13.600000381469727px;line-height:normal;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">Base &amp; Base</code>&nbsp;be valid and equivalent to&nbsp;<code style="box-sizing:border-box;font-family:consolas,'liberation mono',menlo,courier,monospace;font-size:13.600000381469727px;line-height:normal;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">Base</code>?</li><li style="box-sizing:border-box">Should repetition of class requirements through typealias expansion be allowed? I.e., should&nbsp;<code style="box-sizing:border-box;font-family:consolas,'liberation mono',menlo,courier,monospace;font-size:13.600000381469727px;line-height:normal;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">Base &amp; (Base &amp; Protocol)</code>&nbsp;be valid and equivalent to&nbsp;<code style="box-sizing:border-box;font-family:consolas,'liberation mono',menlo,courier,monospace;font-size:13.600000381469727px;line-height:normal;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">Base &amp; Protocol</code>?</li><li style="box-sizing:border-box">Should type and sub-type requirements in the same declaration be allowed? I.e., should&nbsp;<code style="box-sizing:border-box;font-family:consolas,'liberation mono',menlo,courier,monospace;font-size:13.600000381469727px;line-height:normal;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">Base &amp; Derived</code>&nbsp;or&nbsp;<code style="box-sizing:border-box;font-family:consolas,'liberation mono',menlo,courier,monospace;font-size:13.600000381469727px;line-height:normal;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">Derived &amp; Base</code>&nbsp;be valid and equivalent to&nbsp;<code style="box-sizing:border-box;font-family:consolas,'liberation mono',menlo,courier,monospace;font-size:13.600000381469727px;line-height:normal;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">Derived</code>?</li><li style="box-sizing:border-box">Should type and sub-type requirements through typealias expansion be allowed? I.e., should&nbsp;<code style="box-sizing:border-box;font-family:consolas,'liberation mono',menlo,courier,monospace;font-size:13.600000381469727px;line-height:normal;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">Base &amp; (Derived &amp; Protocol)</code>&nbsp;or&nbsp;<code style="box-sizing:border-box;font-family:consolas,'liberation mono',menlo,courier,monospace;font-size:13.600000381469727px;line-height:normal;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">Derived &amp; (Base &amp; Protocol)</code>&nbsp;be valid and equivalent to&nbsp;<code style="box-sizing:border-box;font-family:consolas,'liberation mono',menlo,courier,monospace;font-size:13.600000381469727px;line-height:normal;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">Derived &amp; Protocol</code>?</li></ol></div><div><b>My Answers</b></div><div><br></div><div><ol style="box-sizing:border-box;padding:0px 0px 0px 2em;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:'helvetica neue',helvetica,'segoe ui',arial,freesans,sans-serif;font-size:16px;background-color:rgb(255,255,255)"><li style="box-sizing:border-box">No, for the reasons stated above.</li><li style="box-sizing:border-box">No, because it doesn’t make sense to repeat it in the same declaration.</li><li style="box-sizing:border-box">Yes, I’m gonna start agreeing with you and think will ease typealias composition.</li><li style="box-sizing:border-box">No, for the same reasons as 2.</li><li style="box-sizing:border-box">Yes, for the same reasons as 3.</li></ol></div></div></div></blockquote><div>That's a _reasonable_ set of answers if you want to require Base to precede Protocol *and* you want to ease rules for typealiases. However, using your notation, should `(Protocol &amp; Protocol) &amp; (Base &amp; Protocol)` be allowed?</div></div></div></div></div></blockquote><div><br></div><div>Yes, it would be allowed. I'll mention this example when I write the proposals second draft. Thanks!</div><br><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>If not, your rules will have to get pretty complicated. OTOH,&nbsp;if so, it seems like an awfully heavy-handed yet simultaneously ineffective hardcoding of a style preference, since I'd be able to use `typealias Base_ = Base &amp; Any` to circumvent the rule any time I like.</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div><div><span class="gmail-HOEnZb"><font color="#888888"><div><font color="#333333" face="Helvetica Neue, Helvetica, Segoe UI, Arial, freesans, sans-serif" size="3">David.</font></div></font></span></div><div><div class="gmail-h5"><br><blockquote type="cite"><div><div style="word-wrap:break-word"><div>Matthew</div><div><br></div><div>*** One argument against requiring a class to come first is that we could conceptualize `&amp;` as a type operator with a handful of overloads.&nbsp; This would include both lhs and rhs are “protocol only kinds” as well as overloads with a “protocol only kind” in either lhs or rhs and a “supertype kind” in the other position.&nbsp; The tricky part of pulling this off would be including an overload where both lhs and rhs have a “supertype kind”, but only when the operands have a subtype / supertype relationship with each other. &nbsp;</div><div><br></div><div>I suspect this conceptualization isn’t worth the complexity it brings, but it is tempting to try and view `&amp;` as a type operator.&nbsp; As long as this only involves a loosening of restrictions it could probably be introduced as an additive change down the road.</div><div><br><div><blockquote type="cite"><div>On Jan 29, 2017, at 10:39 AM, David Hart &lt;<a href="mailto:david@hartbit.com" target="_blank">david@hartbit.com</a>&gt; wrote:</div><br class="gmail-m_-4526869765988871141Apple-interchange-newline"><div><div style="word-wrap:break-word">Hello,<div><br></div><div>As promised, I wrote the first draft of a proposal to add class requirements to the existential syntax. Please let me know what you think.</div><div><br></div><div><a href="https://github.com/hartbit/swift-evolution/blob/subclass-existentials/proposals/XXXX-subclass-existentials.md" target="_blank">https://github.com/hartbit/<wbr>swift-evolution/blob/subclass-<wbr>existentials/proposals/XXXX-<wbr>subclass-existentials.md</a></div><div><br></div><div>Regards,</div><div>David.</div><div><br></div><div><h1 style="box-sizing:border-box;margin:0px 0px 16px;line-height:1.25;padding-bottom:0.3em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(238,238,238);color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';background-color:rgb(255,255,255)">Existentials for classes conforming to protocols</h1><ul style="box-sizing:border-box;padding-left:2em;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px;background-color:rgb(255,255,255)"><li style="box-sizing:border-box">Proposal:&nbsp;<a href="https://github.com/hartbit/swift-evolution/blob/subclass-existentials/proposals/XXXX-subclass-existentials.md" style="box-sizing:border-box;background-color:transparent;color:rgb(64,120,192);text-decoration:none" target="_blank">SE-XXXX</a></li><li style="box-sizing:border-box;margin-top:0.25em">Authors:&nbsp;<a href="http://github.com/hartbit/" style="box-sizing:border-box;background-color:transparent;color:rgb(64,120,192);text-decoration:none" target="_blank">David Hart</a>,&nbsp;<a href="http://github.com/austinzheng" style="box-sizing:border-box;background-color:transparent;color:rgb(64,120,192);text-decoration:none" target="_blank">Austin Zheng</a></li><li style="box-sizing:border-box;margin-top:0.25em">Review Manager: TBD</li><li style="box-sizing:border-box;margin-top:0.25em">Status: TBD</li></ul><h2 style="box-sizing:border-box;margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(238,238,238);color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';background-color:rgb(255,255,255)"><a id="gmail-m_-4526869765988871141user-content-introduction" class="gmail-m_-4526869765988871141anchor" href="https://github.com/hartbit/swift-evolution/tree/subclass-existentials/proposals#introduction" style="box-sizing:border-box;background-color:transparent;color:rgb(64,120,192);text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"><u></u><u></u><u></u><u></u></a>Introduction</h2><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px;background-color:rgb(255,255,255)">This proposal brings more expressive power to the type system by allowing Swift to represent existentials of classes and subclasses which conform to protocols.</p><h2 style="box-sizing:border-box;margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(238,238,238);color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';background-color:rgb(255,255,255)"><a id="gmail-m_-4526869765988871141user-content-motivation" class="gmail-m_-4526869765988871141anchor" href="https://github.com/hartbit/swift-evolution/tree/subclass-existentials/proposals#motivation" style="box-sizing:border-box;background-color:transparent;color:rgb(64,120,192);text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"><u></u><u></u><u></u><u></u></a>Motivation</h2><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px;background-color:rgb(255,255,255)">Currently, the only existentials which can be represented in Swift are conformances to a set of protocols, using the&nbsp;<code style="box-sizing:border-box;font-family:consolas,'liberation mono',menlo,courier,monospace;font-size:13.600000381469727px;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">&amp;</code>syntax:</p><div class="gmail-m_-4526869765988871141highlight gmail-m_-4526869765988871141highlight-source-swift" style="box-sizing:border-box;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px;background-color:rgb(255,255,255)"><pre style="box-sizing:border-box;font-family:consolas,'liberation mono',menlo,courier,monospace;font-size:13.600000381469727px;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"><span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> existential<span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">:</span> <span class="gmail-m_-4526869765988871141pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">Hashable</span> <span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">&amp;</span> <span class="gmail-m_-4526869765988871141pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">CustomStringConvertible</span></pre></div><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px;background-color:rgb(255,255,255)">On the other hand, Objective-C is capable of expressing existentials of subclasses conforming to protocols with the following syntax:</p><div class="gmail-m_-4526869765988871141highlight gmail-m_-4526869765988871141highlight-source-objc" style="box-sizing:border-box;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px;background-color:rgb(255,255,255)"><pre style="box-sizing:border-box;font-family:consolas,'liberation mono',menlo,courier,monospace;font-size:13.600000381469727px;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">UIViewController&lt;<wbr>UITableViewDataSource, UITableViewDelegate&gt;* existential;</pre></div><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px;background-color:rgb(255,255,255)">We propose to provide similar expressive power to Swift, which will also improve the bridging of those types from Objective-C.</p><h2 style="box-sizing:border-box;margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(238,238,238);color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';background-color:rgb(255,255,255)"><a id="gmail-m_-4526869765988871141user-content-proposed-solution" class="gmail-m_-4526869765988871141anchor" href="https://github.com/hartbit/swift-evolution/tree/subclass-existentials/proposals#proposed-solution" style="box-sizing:border-box;background-color:transparent;color:rgb(64,120,192);text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"><u></u><u></u><u></u><u></u></a>Proposed solution</h2><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px;background-color:rgb(255,255,255)">The proposal keeps the existing&nbsp;<code style="box-sizing:border-box;font-family:consolas,'liberation mono',menlo,courier,monospace;font-size:13.600000381469727px;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">&amp;</code>&nbsp;syntax but allows the first element, and only the first, to be of class type. The equivalent declaration to the above Objective-C declaration would look like this:</p><div class="gmail-m_-4526869765988871141highlight gmail-m_-4526869765988871141highlight-source-swift" style="box-sizing:border-box;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px;background-color:rgb(255,255,255)"><pre style="box-sizing:border-box;font-family:consolas,'liberation mono',menlo,courier,monospace;font-size:13.600000381469727px;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"><span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> existential<span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">:</span> UIViewController <span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">&amp;</span> UITableViewDataSource <span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">&amp;</span> UITableViewDelegate</pre></div><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px;background-color:rgb(255,255,255)">As in Objective-C, this existential represents classes which have&nbsp;<code style="box-sizing:border-box;font-family:consolas,'liberation mono',menlo,courier,monospace;font-size:13.600000381469727px;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">UIViewController</code>&nbsp;in their parent inheritance hierarchy and which also conform to the&nbsp;<code style="box-sizing:border-box;font-family:consolas,'liberation mono',menlo,courier,monospace;font-size:13.600000381469727px;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">UITableViewDataSource</code>&nbsp;and&nbsp;<code style="box-sizing:border-box;font-family:consolas,'liberation mono',menlo,courier,monospace;font-size:13.600000381469727px;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"><wbr>UITableViewDelegate</code>&nbsp;protocols.</p><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px;background-color:rgb(255,255,255)">As only the first element in the existential composition syntax can be a class type, and by extending this rule to typealias expansions, we can make sure that we only need to read the first element to know if it contains a class requirement. As a consequence, here is a list of valid and invalid code and the reasons for them:</p><div class="gmail-m_-4526869765988871141highlight gmail-m_-4526869765988871141highlight-source-swift" style="box-sizing:border-box;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px;background-color:rgb(255,255,255)"><pre style="box-sizing:border-box;font-family:consolas,'liberation mono',menlo,courier,monospace;font-size:13.600000381469727px;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"><span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> a<span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">:</span> <span class="gmail-m_-4526869765988871141pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">Hashable</span> <span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">&amp;</span> <span class="gmail-m_-4526869765988871141pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">CustomStringConvertible</span>
<span class="gmail-m_-4526869765988871141pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="gmail-m_-4526869765988871141pl-c" style="box-sizing:border-box">//</span> VALID: This is still valid, as before</span>
<span class="gmail-m_-4526869765988871141pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"></span>
<span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> b<span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">:</span> MyObject <span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">&amp;</span> <span class="gmail-m_-4526869765988871141pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">Hashable</span>
<span class="gmail-m_-4526869765988871141pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="gmail-m_-4526869765988871141pl-c" style="box-sizing:border-box">//</span> VALID: This is the new rule which allows an object type in first position</span>
<span class="gmail-m_-4526869765988871141pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"></span>
<span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> c<span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">:</span> <span class="gmail-m_-4526869765988871141pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">CustomStringConvertible</span> <span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">&amp;</span> MyObject
<span class="gmail-m_-4526869765988871141pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="gmail-m_-4526869765988871141pl-c" style="box-sizing:border-box">//</span> INVALID: MyObject is not allowed in second position. A fix-it should help transform it to:</span>
<span class="gmail-m_-4526869765988871141pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="gmail-m_-4526869765988871141pl-c" style="box-sizing:border-box">//</span> let c: MyObject &amp; CustomStringConvertible</span>
<span class="gmail-m_-4526869765988871141pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"></span>
<span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">typealias</span> <span class="gmail-m_-4526869765988871141pl-en" style="box-sizing:border-box;color:rgb(121,93,163)">MyObjectStringConvertible</span> <span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">=</span> MyObject <span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">&amp;</span> <span class="gmail-m_-4526869765988871141pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">CustomStringConvertible</span>
<span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> d<span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">:</span> <span class="gmail-m_-4526869765988871141pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">Hashable</span> <span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">&amp;</span> MyObjectStringConvertible
<span class="gmail-m_-4526869765988871141pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="gmail-m_-4526869765988871141pl-c" style="box-sizing:border-box">//</span> INVALID: The typealias expansion means that the type of d expands to Hashable &amp; MyObject &amp; CustomStringConvertible, which has the class in the wrong position. A fix-it should help transform it to:</span>
<span class="gmail-m_-4526869765988871141pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="gmail-m_-4526869765988871141pl-c" style="box-sizing:border-box">//</span> let d: MyObjectStringConvertible &amp; Hashable</span>
<span class="gmail-m_-4526869765988871141pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"></span>
<span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">typealias</span> <span class="gmail-m_-4526869765988871141pl-en" style="box-sizing:border-box;color:rgb(121,93,163)">MyObjectStringConvertible</span> <span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">=</span> MyObject <span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">&amp;</span> <span class="gmail-m_-4526869765988871141pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">CustomStringConvertible</span>
<span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> e<span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">:</span> MyOtherObject <span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">&amp;</span> MyObjectStringConvertible
<span class="gmail-m_-4526869765988871141pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="gmail-m_-4526869765988871141pl-c" style="box-sizing:border-box">//</span> INVALID: The typealias expansion would allow an existential with two class requirements, which is invalid</span></pre></div><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px;background-color:rgb(255,255,255)">The following examples could technically be legal, but we believe we should keep them invalid to keep the rules simple:</p><div class="gmail-m_-4526869765988871141highlight gmail-m_-4526869765988871141highlight-source-swift" style="box-sizing:border-box;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px;background-color:rgb(255,255,255)"><pre style="box-sizing:border-box;font-family:consolas,'liberation mono',menlo,courier,monospace;font-size:13.600000381469727px;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"><span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> a<span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">:</span> MyObject <span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">&amp;</span> MyObject <span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">&amp;</span> <span class="gmail-m_-4526869765988871141pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">CustomStringConvertible</span>
<span class="gmail-m_-4526869765988871141pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="gmail-m_-4526869765988871141pl-c" style="box-sizing:border-box">//</span> This is equivalent to MyObject &amp; CustomStringConvertible</span>
<span class="gmail-m_-4526869765988871141pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"></span>
<span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> b<span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">:</span> MyObjectSubclass <span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">&amp;</span> MyObject <span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">&amp;</span> <span class="gmail-m_-4526869765988871141pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">Hashable</span>
<span class="gmail-m_-4526869765988871141pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="gmail-m_-4526869765988871141pl-c" style="box-sizing:border-box">//</span> This is equivalent to MyObjectSubclass &amp; Hashable</span>
<span class="gmail-m_-4526869765988871141pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"></span>
<span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">typealias</span> <span class="gmail-m_-4526869765988871141pl-en" style="box-sizing:border-box;color:rgb(121,93,163)">MyObjectStringConvertible</span> <span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">=</span> MyObject <span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">&amp;</span> <span class="gmail-m_-4526869765988871141pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">CustomStringConvertible</span>
<span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> d<span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">:</span> MyObject <span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">&amp;</span> MyObjectStringConvertible
<span class="gmail-m_-4526869765988871141pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="gmail-m_-4526869765988871141pl-c" style="box-sizing:border-box">//</span> This is equivalent to MyObject &amp; CustomStringConvertible</span></pre></div><h2 style="box-sizing:border-box;margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(238,238,238);color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';background-color:rgb(255,255,255)"><a id="gmail-m_-4526869765988871141user-content-source-compatibility" class="gmail-m_-4526869765988871141anchor" href="https://github.com/hartbit/swift-evolution/tree/subclass-existentials/proposals#source-compatibility" style="box-sizing:border-box;background-color:transparent;color:rgb(64,120,192);text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"><u></u><u></u><u></u><u></u></a>Source compatibility</h2><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px;background-color:rgb(255,255,255)">This is a source breaking change. All types bridged from Objective-C which use the equivalent Objective-C feature import without the protocol conformances in Swift 3. This change would increase the existential's requirement and break on code which does not meet the new protocol requirements. For example, the following Objective-C code:</p><div class="gmail-m_-4526869765988871141highlight gmail-m_-4526869765988871141highlight-source-objc" style="box-sizing:border-box;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px;background-color:rgb(255,255,255)"><pre style="box-sizing:border-box;font-family:consolas,'liberation mono',menlo,courier,monospace;font-size:13.600000381469727px;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"><span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">@interface</span> <span class="gmail-m_-4526869765988871141pl-en" style="box-sizing:border-box;color:rgb(121,93,163)">MyViewController</span>
- (<span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">void</span>)<span class="gmail-m_-4526869765988871141pl-en" style="box-sizing:border-box;color:rgb(121,93,163)">setup</span><span class="gmail-m_-4526869765988871141pl-en" style="box-sizing:border-box;color:rgb(121,93,163)">:</span>(nonnull UIViewController&lt;<wbr>UITableViewDataSource,<wbr>UITableViewDelegate&gt;*)<span class="gmail-m_-4526869765988871141pl-smi" style="box-sizing:border-box">tableVie<wbr>wController</span>;
<span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">@end</span></pre></div><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px;background-color:rgb(255,255,255)">is imported into Swift 3 as:</p><div class="gmail-m_-4526869765988871141highlight gmail-m_-4526869765988871141highlight-source-swift" style="box-sizing:border-box;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px;background-color:rgb(255,255,255)"><pre style="box-sizing:border-box;font-family:consolas,'liberation mono',menlo,courier,monospace;font-size:13.600000381469727px;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"><span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">class</span> <span class="gmail-m_-4526869765988871141pl-en" style="box-sizing:border-box;color:rgb(121,93,163)">MyViewController</span> {
    <span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">func</span> <span class="gmail-m_-4526869765988871141pl-en" style="box-sizing:border-box;color:rgb(121,93,163)">setup</span>(<span class="gmail-m_-4526869765988871141pl-smi" style="box-sizing:border-box"><span class="gmail-m_-4526869765988871141pl-en" style="box-sizing:border-box;color:rgb(121,93,163)">tableViewController</span></span>: UIViewController) {}
}</pre></div><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px;background-color:rgb(255,255,255)">which allows calling the function with an invalid parameter:</p><div class="gmail-m_-4526869765988871141highlight gmail-m_-4526869765988871141highlight-source-swift" style="box-sizing:border-box;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px;background-color:rgb(255,255,255)"><pre style="box-sizing:border-box;font-family:consolas,'liberation mono',menlo,courier,monospace;font-size:13.600000381469727px;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"><span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> myViewController<span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">:</span> <span class="gmail-m_-4526869765988871141pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">MyViewController</span>()
myViewController.<span class="gmail-m_-4526869765988871141pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">setup</span>(<span class="gmail-m_-4526869765988871141pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">UIViewC<wbr>ontroller</span>())</pre></div><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px;background-color:rgb(255,255,255)">The previous code would have worked as long as the Objective-C code did not call any method of&nbsp;<code style="box-sizing:border-box;font-family:consolas,'liberation mono',menlo,courier,monospace;font-size:13.600000381469727px;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">UITableViewDataSource</code>&nbsp;or&nbsp;<code style="box-sizing:border-box;font-family:consolas,'liberation mono',menlo,courier,monospace;font-size:13.600000381469727px;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">UI<wbr>TableViewDelegate</code>. But if this proposal is accepted and implemented as-is, the Objective-C code would now be imported as:</p><div class="gmail-m_-4526869765988871141highlight gmail-m_-4526869765988871141highlight-source-swift" style="box-sizing:border-box;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px;background-color:rgb(255,255,255)"><pre style="box-sizing:border-box;font-family:consolas,'liberation mono',menlo,courier,monospace;font-size:13.600000381469727px;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"><span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">class</span> <span class="gmail-m_-4526869765988871141pl-en" style="box-sizing:border-box;color:rgb(121,93,163)">MyViewController</span> {
    <span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">func</span> <span class="gmail-m_-4526869765988871141pl-en" style="box-sizing:border-box;color:rgb(121,93,163)">setup</span>(<span class="gmail-m_-4526869765988871141pl-smi" style="box-sizing:border-box"><span class="gmail-m_-4526869765988871141pl-en" style="box-sizing:border-box;color:rgb(121,93,163)">tableViewController</span></span>: UIViewController <span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">&amp;</span> UITableViewDataSource <span class="gmail-m_-4526869765988871141pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">&amp;</span> UITableViewDelegate) {}
}</pre></div><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px;background-color:rgb(255,255,255)">That would then cause the Swift code to fail to compile with an error which states that&nbsp;<code style="box-sizing:border-box;font-family:consolas,'liberation mono',menlo,courier,monospace;font-size:13.600000381469727px;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">UIViewController</code>&nbsp;does not conform to the&nbsp;<code style="box-sizing:border-box;font-family:consolas,'liberation mono',menlo,courier,monospace;font-size:13.600000381469727px;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">UITableViewDataSource</code>&nbsp;and&nbsp;<code style="box-sizing:border-box;font-family:consolas,'liberation mono',menlo,courier,monospace;font-size:13.600000381469727px;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"><wbr>UITableViewDelegate</code>&nbsp;protocols.</p><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px;background-color:rgb(255,255,255)">It is a source-breaking change, but should have a minimal impact for the following reasons:</p><ul style="box-sizing:border-box;padding-left:2em;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px;background-color:rgb(255,255,255)"><li style="box-sizing:border-box">Not many Objective-C code used the existential syntax in practice.</li><li style="box-sizing:border-box;margin-top:0.25em">There generated errors are a good thing because they point out potential crashes which would have gone un-noticed.</li></ul><h2 style="box-sizing:border-box;margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(238,238,238);color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';background-color:rgb(255,255,255)"><a id="gmail-m_-4526869765988871141user-content-alternatives-considered" class="gmail-m_-4526869765988871141anchor" href="https://github.com/hartbit/swift-evolution/tree/subclass-existentials/proposals#alternatives-considered" style="box-sizing:border-box;background-color:transparent;color:rgb(64,120,192);text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"><u></u><u></u><u></u><u></u></a>Alternatives considered</h2><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px;background-color:rgb(255,255,255)">None.</p><h2 style="box-sizing:border-box;margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(238,238,238);color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';background-color:rgb(255,255,255)"><a id="gmail-m_-4526869765988871141user-content-acknowledgements" class="gmail-m_-4526869765988871141anchor" href="https://github.com/hartbit/swift-evolution/tree/subclass-existentials/proposals#acknowledgements" style="box-sizing:border-box;background-color:transparent;color:rgb(64,120,192);text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"><u></u><u></u><u></u><u></u></a>Acknowledgements</h2><div style="box-sizing:border-box;margin-top:0px;color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px;background-color:rgb(255,255,255);margin-bottom:0px">Thanks to&nbsp;<a href="http://github.com/austinzheng" style="box-sizing:border-box;background-color:transparent;color:rgb(64,120,192);text-decoration:none" target="_blank">Austin Zheng</a>&nbsp;and&nbsp;<a href="https://github.com/anandabits" style="box-sizing:border-box;background-color:transparent;color:rgb(64,120,192);text-decoration:none" target="_blank">Matthew Johnson</a>&nbsp;who brought a lot of attention to existentials in this mailing-list and from whom most of the ideas in the proposal come from.</div></div></div></div></blockquote></div><br></div></div></div></blockquote></div></div></div><br></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></body></html>