Optional a could be implemented with both enumerated and unions with this proposal but there should be an Undefined type whose only possible value is nil. It would make no sense but you could declare a function argument or return or even a property whose type is Undefined too. And this would lead to otherwise unnecessary code.<div><br></div><div>I do agree with the idea of unions but I don&#39;t believe optionals would be better implemented with it,<br><br>On Saturday, 14 May 2016, Cao Jiannan via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><div><div style="word-wrap:break-word"><div><div style="word-wrap:break-word"><div><div><div><div style="word-wrap:break-word"><div>It’s kind of same idea of TypeScipt 2, at 46:21 in this video.</div><div><br></div><a href="https://channel9.msdn.com/Events/Build/2016/B881" target="_blank">https://channel9.msdn.com/Events/Build/2016/B881</a><div><br></div><div><img height="202" width="320" src="cid:3843F15D-CE8F-4C2D-8508-72ACDE7DE137"><br><div><br></div><div><br><div><blockquote type="cite"><div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:-webkit-system-font,&#39;Helvetica Neue&#39;,Helvetica,sans-serif">2016-2-16 GMT+8 14:36:28</span></div></div></blockquote><div><div><div style="word-wrap:break-word"><div><blockquote type="cite"><div><div>Hi all,</div><div><br></div><div>I think the best way to solve the either problem is to separate it from generic. </div><div>Optional and Either shouldn’t work the same way of generic type. </div><div>It’s just a represent of multiple type in one location.</div><div><br></div><div>Using an old friend, Union in C.</div><div>union {</div><div><span style="white-space:pre-wrap">        </span>case firstType</div><div><span style="white-space:pre-wrap">        </span>case secondType</div><div>}</div><div><br></div><div>This is the final solution for the sub typing problem of optional.</div></div></blockquote></div></div></div></div><blockquote type="cite"><div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">A  == union(A,A)</div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div>union(A,B) == union(B,A)</div></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">B == union(B,B)</div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">B is subtype of union(A,B)</div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">A is subtype of union(A,B)</div></div></blockquote><blockquote type="cite">union(A,B,C) is subtype of union(A,B,C,D,…)<br></blockquote><blockquote type="cite"><div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div>suppose </div><div>a is subclass of A</div><div>b is subclass of B, then</div></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div><span style="white-space:pre-wrap">        </span>union(a,B) is subtype of union(A,B)</div><div><span style="white-space:pre-wrap">        </span>union(A,b) is subtype of union(A,B)</div></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div><span style="white-space:pre-wrap">        </span>union(a,b) is subtype of union(a,B)</div></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div><span style="white-space:pre-wrap">        </span>union(a,b) is subtype of union(A,b)</div></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">union can have as many case as possible. e.g., union(A,B,C,D,…)</div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">So the Optional&lt;UITableView&gt; should be union(UITableView, None)</div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">and Optional&lt;MyTableVIew&gt; should be union(MyTableView, None), which is subclass of union(UITableView, None)</div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">This is a final rational solution. I think.</div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">-Jiannan</div><br></div></blockquote></div><br></div></div></div></div></div></div><br></div>
</div><br></div></div><div><br></div></div></div></blockquote></div><br><br>-- <br><div dir="ltr"><div><div dir="ltr"><font face="trebuchet ms, sans-serif">- Leonardo</font></div></div></div><br>