<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=""><div class="">Using Optional&lt;Wrapped&gt; generic leads to many problems, including this one.</div><div class="">Why subclass of UITableView cannot conform to this protocol? This is very weird.</div><div class=""><br class=""></div><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class=""><div dir="auto" class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div dir="auto" class=""><div class=""><div class=""><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class="dp-highlighter" style="box-sizing: border-box; padding: 1px 0px 0px; border: none; font-family: Consolas, 'Courier New', Courier, mono, serif; vertical-align: baseline; background-color: rgb(249, 249, 249); width: auto; overflow: visible; color: rgb(51, 51, 51); margin: 0px !important;"><ol start="1" class="dp-j" style="box-sizing: border-box; padding: 0px; border: none; font-style: inherit; font-family: inherit; vertical-align: baseline; list-style-position: initial; list-style-image: initial; background-color: rgb(255, 255, 255); color: rgb(92, 92, 92); margin: 0px 0px 1px 45px !important;"><li class="alt" style="box-sizing: border-box; border-left-width: 3px; border-style: none none none solid; border-left-color: rgb(255, 255, 255); font-style: inherit; font-size: 1em; font-family: inherit; vertical-align: baseline; line-height: 12pt; list-style: decimal-leading-zero outside; color: inherit; height: 12pt; position: relative; white-space: nowrap; margin: 0px !important; padding: 0px 3px 0px 10px !important;"><span class="" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font-style: inherit; vertical-align: baseline; font-size: 9pt !important;">protocol&nbsp;&nbsp;SegueHandlerType&nbsp;{&nbsp;&nbsp;</span></li><li class="" style="box-sizing: border-box; border-left-width: 3px; border-style: none none none solid; border-left-color: rgb(255, 255, 255); font-style: inherit; font-size: 1em; font-family: inherit; vertical-align: baseline; line-height: 12pt; list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); height: 12pt; position: relative; white-space: nowrap; margin: 0px !important; padding: 0px 3px 0px 10px !important;"><span class="" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font-style: inherit; vertical-align: baseline; font-size: 9pt !important;">&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;tableView:&nbsp;UITableView!&nbsp;{&nbsp;get&nbsp;}&nbsp;&nbsp;</span></li><li class="alt" style="box-sizing: border-box; border-left-width: 3px; border-style: none none none solid; border-left-color: rgb(255, 255, 255); font-style: inherit; font-size: 1em; font-family: inherit; vertical-align: baseline; line-height: 12pt; list-style: decimal-leading-zero outside; color: inherit; height: 12pt; position: relative; white-space: nowrap; margin: 0px !important; padding: 0px 3px 0px 10px !important;"><span class="" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font-style: inherit; vertical-align: baseline; font-size: 9pt !important;">}&nbsp;</span></li></ol></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div><div class=""><br class=""></div></div><div class="">The complex design of using generic to implement optional feature, leads to many problems.</div><div class="">What is the type relation between A!, A?, A and B!, B?, B (if B is subtype of A)</div><div class="">This made a clear answer hard to answer.</div><div class=""><br class=""></div><div class="">In my opinion, A!, A?, A should be the same class, the only difference is the runtime checking,&nbsp;</div><div class="">not using the generic checking, because they are really the same type.</div><div class=""><br class=""></div><div class="">&nbsp;</div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">在 2016年2月16日,13:26,Cao Jiannan 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=""><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="">I mean,</div><div class=""><br class=""></div><div class="">we only allow the class which not defined property like this kind of to has this feature.</div><div class=""><br class=""></div><div class="">or we only allow the system Optional type has this feature.</div><div class=""><br class=""></div><div class="">because Optional&lt;B&gt; is subclass of Optional&lt;A&gt;, this is very rational!</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">I think the problem is to implement optional with generic.&nbsp;</div><div class="">There are many other ways to implement optional feature, use generic maybe a bad idea.</div><div class=""><br class=""></div><br class=""><div class=""><blockquote type="cite" class=""><div class="">在 2016年2月16日,13:20,Developer &lt;<a href="mailto:devteam.codafi@gmail.com" class="">devteam.codafi@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 dir="auto" class=""><div class=""><span class=""></span></div><div class=""><div class="">OK, one type parameter then</div><div class=""><br class=""></div><div class="">struct IO&lt;A&gt; { //... }</div><div class=""><br class=""></div><div class="">struct&nbsp;<span style="background-color: rgba(255, 255, 255, 0);" class=""><span class="pl-c1" style="box-sizing: border-box;">Observer&lt;</span>A&gt;&nbsp;{&nbsp;</span></div><div class=""><span style="background-color: rgba(255, 255, 255, 0);" class=""><span class="pl-k" style="box-sizing: border-box;">&nbsp; let unObserver : A</span>&nbsp;<span class="pl-k" style="box-sizing: border-box;">-&gt;</span> <span class="pl-c1" style="box-sizing: border-box;">IO&lt;</span><span class="pl-c1" style="box-sizing: border-box;">()&gt;</span></span></div><div class=""><span style="background-color: rgba(255, 255, 255, 0);" class=""> }</span></div><div class=""><br class=""></div><div class="">Point is, if you're going to introduce variance it has to go both ways. &nbsp;That means you'll need something more in the language than a typing rule that just works in this one small case.<br class=""><br class=""><div class="">~Robert Widmann</div></div><div class=""><br class="">2016/02/16 0:00、Cao Jiannan &lt;<a href="mailto:frogcjn@163.com" class="">frogcjn@163.com</a>&gt; のメッセージ:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class="">OK, let narrow the problem.<div class=""><br class=""></div><div class=""><div dir="auto" class=""><div class=""><div class=""><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class="">if B is subclass of A</div><div class="">Optional&lt;B&gt; is subclass of Optional&lt;A&gt;</div><div class=""><br class=""></div><div class="">Not allow multiple type template.</div><div class=""><br class=""></div><div class=""><br class=""></div></div></div></div></div></div></div></div></div></div></div><br class=""></div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">在 2016年2月16日,12:29,Developer &lt;<a href="mailto:devteam.codafi@gmail.com" class="">devteam.codafi@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 dir="auto" class=""><div class=""><div class=""><span style="background-color: rgba(255, 255, 255, 0);" class="">OK, so you have covariance covered, now what about contravariance? &nbsp;Surely a structure like this</span></div><div class=""><span style="background-color: rgba(255, 255, 255, 0);" class=""><br class=""></span></div><div class=""><span style="background-color: rgba(255, 255, 255, 0);" class="">struct Arrow&lt;A, B&gt; {</span></div><div class=""><span style="background-color: rgba(255, 255, 255, 0);" class="">&nbsp; let unArrow : A -&gt; B</span></div><div class=""><span style="background-color: rgba(255, 255, 255, 0);" class="">}</span></div><div class=""><span style="background-color: rgba(255, 255, 255, 0);" class=""><br class=""></span></div><div class=""><span style="background-color: rgba(255, 255, 255, 0);" class="">should be contravariant in its first argument and covariant in its second.</span></div><br class="">~Robert Widmann</div><div class=""><br class="">2016/02/15 22:48、Cao Jiannan via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; のメッセージ:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><meta http-equiv="Content-Type" content="text/html charset=gb2312" class=""><div class=""><span style="color: rgb(51, 51, 51); font-family: inherit; font-size: 10pt; font-style: inherit;" class=""><br class=""></span></div><span style="color: rgb(51, 51, 51); font-family: inherit; font-size: 10pt; font-style: inherit;" class="">Hi all,</span><br class=""><div class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><span class="" style="font-family: inherit; color: rgb(51, 51, 51); font-size: 10pt; font-style: inherit;">I&nbsp;</span><font color="#333333" face="Helvetica Neue" size="2" class="" style="font-family: 'Helvetica Neue';">want to discuss on a&nbsp;</font><span style="color: rgb(51, 51, 51); font-family: 'Helvetica Neue'; font-size: small;" class="">problem</span>&nbsp; about&nbsp;<span style="font-family: 'Helvetica Neue'; color: rgb(51, 51, 51); font-size: small;" class="">optional generic&nbsp;sub-typing.</span></div><div class=""><div class=""><br class=""></div><div class=""><div class="">This is my suggesion.</div><div class=""><br class=""></div></div><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class="">if B is subclass of A</div><div class="">Either&lt;B,B&gt; is subclass of Either&lt;A,A&gt;, Either&lt;A,B&gt;, Either&lt;B,A&gt;</div><div class="">Either&lt;B,A&gt; is subclass of Either&lt;A,A&gt;</div><div class=""><div class="">Either&lt;A,B&gt; is subclass of Either&lt;A,A&gt;</div><div class=""><br class=""></div></div></div></div></div></div><blockquote type="cite" class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""></div><div class=""></div></div></div></div></div></blockquote></div><div class="">Why? Let’s see an example code in a real project:</div><div class=""><br class=""></div><div class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="margin: 0px 0px 0px 6px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><span style="color: rgb(51, 51, 51); font-family: inherit; font-size: 10pt; font-style: inherit;" class=""><br class=""></span></div><div style="margin: 0px 0px 0px 6px; line-height: normal; font-family: 'Helvetica Neue';" class=""><span style="color: rgb(51, 51, 51); font-family: inherit; font-size: 10pt; font-style: inherit;" class="">Here is a protocol type for some UIViewController,</span></div><div class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class="dp-highlighter" style="box-sizing: border-box; padding: 1px 0px 0px; border: none; font-family: Consolas, 'Courier New', Courier, mono, serif; vertical-align: baseline; background-color: rgb(249, 249, 249); width: auto; overflow: visible; color: rgb(51, 51, 51); margin: 0px !important;"><div class="bar" style="box-sizing: border-box; margin: 0px; padding: 0px 0px 0px 45px; border: 0px; font-style: inherit; font-family: inherit; vertical-align: baseline;"><div class="" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-family: inherit; vertical-align: baseline;"></div></div><ol start="1" class="dp-j" style="box-sizing: border-box; padding: 0px; border: none; font-style: inherit; font-family: inherit; vertical-align: baseline; list-style-position: initial; list-style-image: initial; background-color: rgb(255, 255, 255); color: rgb(92, 92, 92); margin: 0px 0px 1px 45px !important;"><li class="alt" style="box-sizing: border-box; border-left-width: 3px; border-style: none none none solid; border-left-color: rgb(255, 255, 255); font-style: inherit; font-size: 1em; font-family: inherit; vertical-align: baseline; line-height: 12pt; list-style: decimal-leading-zero outside; color: inherit; height: 12pt; position: relative; white-space: nowrap; margin: 0px !important; padding: 0px 3px 0px 10px !important;"><span class="" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font-style: inherit; vertical-align: baseline; background-color: inherit; font-size: 9pt !important;">protocol&nbsp;&nbsp;SegueHandlerType&nbsp;{&nbsp;&nbsp;</span></li><li class="" style="box-sizing: border-box; border-left-width: 3px; border-style: none none none solid; border-left-color: rgb(255, 255, 255); font-style: inherit; font-size: 1em; font-family: inherit; vertical-align: baseline; line-height: 12pt; list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); height: 12pt; position: relative; white-space: nowrap; margin: 0px !important; padding: 0px 3px 0px 10px !important;"><span class="" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font-style: inherit; vertical-align: baseline; background-color: inherit; font-size: 9pt !important;">&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;tableView:&nbsp;UITableView!&nbsp;{&nbsp;get&nbsp;}&nbsp;&nbsp;</span></li><li class="alt" style="box-sizing: border-box; border-left-width: 3px; border-style: none none none solid; border-left-color: rgb(255, 255, 255); font-style: inherit; font-size: 1em; font-family: inherit; vertical-align: baseline; line-height: 12pt; list-style: decimal-leading-zero outside; color: inherit; height: 12pt; position: relative; white-space: nowrap; margin: 0px !important; padding: 0px 3px 0px 10px !important;"><span class="" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font-style: inherit; vertical-align: baseline; background-color: inherit; font-size: 9pt !important;">}&nbsp;&nbsp;</span></li></ol></div><div class="" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font-size: 16px; font-family: 'Myriad Set Pro', 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, Verdana, sans-serif; vertical-align: baseline; line-height: 1.4737em; color: rgb(51, 51, 51);"><br class=""></div><div class="" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font-size: 16px; font-family: 'Myriad Set Pro', 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, Verdana, sans-serif; vertical-align: baseline; line-height: 1.4737em; color: rgb(51, 51, 51);"><span class="" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-size: 10pt; font-family: inherit; vertical-align: baseline;">so the UITableViewController can conform to the protocal</span></div><div class="dp-highlighter" style="box-sizing: border-box; padding: 1px 0px 0px; border: none; font-family: Consolas, 'Courier New', Courier, mono, serif; vertical-align: baseline; background-color: rgb(249, 249, 249); width: auto; overflow: visible; color: rgb(51, 51, 51); margin: 0px !important;"><div class="bar" style="box-sizing: border-box; margin: 0px; padding: 0px 0px 0px 45px; border: 0px; font-style: inherit; font-family: inherit; vertical-align: baseline;"><div class="" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-family: inherit; vertical-align: baseline;"></div></div><ol start="1" class="dp-j" style="box-sizing: border-box; padding: 0px; border: none; font-style: inherit; font-family: inherit; vertical-align: baseline; list-style-position: initial; list-style-image: initial; background-color: rgb(255, 255, 255); color: rgb(92, 92, 92); margin: 0px 0px 1px 45px !important;"><li class="alt" style="box-sizing: border-box; border-left-width: 3px; border-style: none none none solid; border-left-color: rgb(255, 255, 255); font-style: inherit; font-size: 1em; font-family: inherit; vertical-align: baseline; line-height: 12pt; list-style: decimal-leading-zero outside; color: inherit; height: 12pt; position: relative; white-space: nowrap; margin: 0px !important; padding: 0px 3px 0px 10px !important;"><span class="" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font-style: inherit; vertical-align: baseline; background-color: inherit; font-size: 9pt !important;">extension&nbsp;UITableViewController&nbsp;:&nbsp;SegueHandlerType&nbsp;{&nbsp;&nbsp;</span></li><li class="" style="box-sizing: border-box; border-left-width: 3px; border-style: none none none solid; border-left-color: rgb(255, 255, 255); font-style: inherit; font-size: 1em; font-family: inherit; vertical-align: baseline; line-height: 12pt; list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); height: 12pt; position: relative; white-space: nowrap; margin: 0px !important; padding: 0px 3px 0px 10px !important;"><span class="" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font-style: inherit; vertical-align: baseline; background-color: inherit; font-size: 9pt !important;">}&nbsp;&nbsp;</span></li></ol></div><div class="" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font-size: 16px; font-family: 'Myriad Set Pro', 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, Verdana, sans-serif; vertical-align: baseline; line-height: 1.4737em; color: rgb(51, 51, 51);"><span class="" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-size: 10pt; font-family: inherit; vertical-align: baseline;"><br class="" style="box-sizing: border-box;"></span></div><div class="" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font-size: 16px; font-family: 'Myriad Set Pro', 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, Verdana, sans-serif; vertical-align: baseline; line-height: 1.4737em; color: rgb(51, 51, 51);"><span class="" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-size: 10pt; font-family: inherit; vertical-align: baseline;">It's great!</span></div><div class="" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font-size: 16px; font-family: 'Myriad Set Pro', 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, Verdana, sans-serif; vertical-align: baseline; line-height: 1.4737em; color: rgb(51, 51, 51);"><span class="" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-size: 10pt; font-family: inherit; vertical-align: baseline;">What if the tableView is a subclass UITableView?</span></div><div class="" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font-size: 16px; font-family: 'Myriad Set Pro', 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, Verdana, sans-serif; vertical-align: baseline; line-height: 1.4737em; color: rgb(51, 51, 51);"><span class="" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-size: 10pt; font-family: inherit; vertical-align: baseline;">like:</span></div><div class="dp-highlighter" style="box-sizing: border-box; padding: 1px 0px 0px; border: none; font-family: Consolas, 'Courier New', Courier, mono, serif; vertical-align: baseline; background-color: rgb(249, 249, 249); width: auto; overflow: visible; color: rgb(51, 51, 51); margin: 0px !important;"><div class="bar" style="box-sizing: border-box; margin: 0px; padding: 0px 0px 0px 45px; border: 0px; font-style: inherit; font-family: inherit; vertical-align: baseline;"><div class="" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-family: inherit; vertical-align: baseline;"></div></div><ol start="1" class="dp-j" style="box-sizing: border-box; padding: 0px; border: none; font-style: inherit; font-family: inherit; vertical-align: baseline; list-style-position: initial; list-style-image: initial; background-color: rgb(255, 255, 255); color: rgb(92, 92, 92); margin: 0px 0px 1px 45px !important;"><li class="alt" style="box-sizing: border-box; border-left-width: 3px; border-style: none none none solid; border-left-color: rgb(255, 255, 255); font-style: inherit; font-size: 1em; font-family: inherit; vertical-align: baseline; line-height: 12pt; list-style: decimal-leading-zero outside; color: inherit; height: 12pt; position: relative; white-space: nowrap; margin: 0px !important; padding: 0px 3px 0px 10px !important;"><span class="" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font-style: inherit; vertical-align: baseline; background-color: inherit; font-size: 9pt !important;">class MyTableView : UITableView {</span></li><li class="alt" style="box-sizing: border-box; border-left-width: 3px; border-style: none none none solid; border-left-color: rgb(255, 255, 255); font-style: inherit; font-size: 1em; font-family: inherit; vertical-align: baseline; line-height: 12pt; list-style: decimal-leading-zero outside; color: inherit; height: 12pt; position: relative; white-space: nowrap; margin: 0px !important; padding: 0px 3px 0px 10px !important;"><span class="" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font-style: inherit; vertical-align: baseline; background-color: inherit; font-size: 9pt !important;">}</span></li><li class="alt" style="box-sizing: border-box; border-left-width: 3px; border-style: none none none solid; border-left-color: rgb(255, 255, 255); font-style: inherit; font-size: 1em; font-family: inherit; vertical-align: baseline; line-height: 12pt; list-style: decimal-leading-zero outside; color: inherit; height: 12pt; position: relative; white-space: nowrap; margin: 0px !important; padding: 0px 3px 0px 10px !important;"><span class="" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font-style: inherit; vertical-align: baseline; background-color: inherit; font-size: 9pt !important;"><br class=""></span></li><li class="alt" style="box-sizing: border-box; border-left-width: 3px; border-style: none none none solid; border-left-color: rgb(255, 255, 255); font-style: inherit; font-size: 1em; font-family: inherit; vertical-align: baseline; line-height: 12pt; list-style: decimal-leading-zero outside; color: inherit; height: 12pt; position: relative; white-space: nowrap; margin: 0px !important; padding: 0px 3px 0px 10px !important;"><span class="" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font-style: inherit; vertical-align: baseline; background-color: inherit; font-size: 9pt !important;">MyTableViewController&nbsp;{&nbsp;&nbsp;</span></li><li class="" style="box-sizing: border-box; border-left-width: 3px; border-style: none none none solid; border-left-color: rgb(255, 255, 255); font-style: inherit; font-size: 1em; font-family: inherit; vertical-align: baseline; line-height: 12pt; list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); height: 12pt; position: relative; white-space: nowrap; margin: 0px !important; padding: 0px 3px 0px 10px !important;"><span class="" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font-style: inherit; vertical-align: baseline; background-color: inherit; font-size: 9pt !important;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="annotation" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font-style: inherit; vertical-align: baseline; color: rgb(100, 100, 100); background-color: inherit; font-size: 9pt !important;">@IBOutlet</span><span class="" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font-style: inherit; vertical-align: baseline; background-color: inherit; font-size: 9pt !important;">&nbsp;var&nbsp;tableView:&nbsp;MyTableView! &nbsp;</span></span></li><li class="" style="box-sizing: border-box; border-left-width: 3px; border-style: none none none solid; border-left-color: rgb(255, 255, 255); font-style: inherit; font-size: 1em; font-family: inherit; vertical-align: baseline; line-height: 12pt; list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); height: 12pt; position: relative; white-space: nowrap; margin: 0px !important; padding: 0px 3px 0px 10px !important;"><span class="" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font-style: inherit; vertical-align: baseline; background-color: inherit; font-size: 9pt !important;">}&nbsp;&nbsp;</span></li></ol></div><div class="" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font-size: 16px; font-family: 'Myriad Set Pro', 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, Verdana, sans-serif; vertical-align: baseline; line-height: 1.4737em; color: rgb(51, 51, 51);"><br class=""></div><div class="" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font-size: 16px; font-family: 'Myriad Set Pro', 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, Verdana, sans-serif; vertical-align: baseline; line-height: 1.4737em; color: rgb(51, 51, 51);"><span class="" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-size: 10pt; font-family: inherit; vertical-align: baseline;">Then&nbsp;</span></div><div class="dp-highlighter" style="box-sizing: border-box; padding: 1px 0px 0px; border: none; font-family: Consolas, 'Courier New', Courier, mono, serif; vertical-align: baseline; background-color: rgb(249, 249, 249); width: auto; overflow: visible; color: rgb(51, 51, 51); margin: 0px !important;"><div class="bar" style="box-sizing: border-box; margin: 0px; padding: 0px 0px 0px 45px; border: 0px; font-style: inherit; font-family: inherit; vertical-align: baseline;"><div class="" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-family: inherit; vertical-align: baseline;"></div></div><ol start="1" class="dp-j" style="box-sizing: border-box; padding: 0px; border: none; font-style: inherit; font-family: inherit; vertical-align: baseline; list-style-position: initial; list-style-image: initial; background-color: rgb(255, 255, 255); color: rgb(92, 92, 92); margin: 0px 0px 1px 45px !important;"><li class="alt" style="box-sizing: border-box; border-left-width: 3px; border-style: none none none solid; border-left-color: rgb(255, 255, 255); font-style: inherit; font-size: 1em; font-family: inherit; vertical-align: baseline; line-height: 12pt; list-style: decimal-leading-zero outside; color: inherit; height: 12pt; position: relative; white-space: nowrap; margin: 0px !important; padding: 0px 3px 0px 10px !important;"><span class="" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font-style: inherit; vertical-align: baseline; background-color: inherit; font-size: 9pt !important;">extension&nbsp;MyTableViewController:SegueHandlerType&nbsp;{&nbsp;&nbsp;</span></li><li class="" style="box-sizing: border-box; border-left-width: 3px; border-style: none none none solid; border-left-color: rgb(255, 255, 255); font-style: inherit; font-size: 1em; font-family: inherit; vertical-align: baseline; line-height: 12pt; list-style: decimal-leading-zero outside; background-color: rgb(248, 248, 248); height: 12pt; position: relative; white-space: nowrap; margin: 0px !important; padding: 0px 3px 0px 10px !important;"><span class="" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font-style: inherit; vertical-align: baseline; background-color: inherit; font-size: 9pt !important;">&nbsp;&nbsp;</span></li><li class="alt" style="box-sizing: border-box; border-left-width: 3px; border-style: none none none solid; border-left-color: rgb(255, 255, 255); font-style: inherit; font-size: 1em; font-family: inherit; vertical-align: baseline; line-height: 12pt; list-style: decimal-leading-zero outside; color: inherit; height: 12pt; position: relative; white-space: nowrap; margin: 0px !important; padding: 0px 3px 0px 10px !important;"><span class="" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font-style: inherit; vertical-align: baseline; background-color: inherit; font-size: 9pt !important;">}&nbsp;&nbsp;</span></li></ol></div><div class="" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font-size: 16px; font-family: 'Myriad Set Pro', 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, Verdana, sans-serif; line-height: 1.4737em;"><span style="font-family: Helvetica; font-size: 12px;" class="">will trigger a compiler error.</span><br style="font-family: Helvetica; font-size: 12px;" class=""><span style="font-family: Helvetica; font-size: 12px;" class="">&nbsp;</span><br style="font-family: Helvetica; font-size: 12px;" class=""><span style="font-family: Helvetica; font-size: 12px;" class="">So the Optional needs a subclass system.</span><br style="font-family: Helvetica; font-size: 12px;" class=""><span style="font-family: Helvetica; font-size: 12px;" class="">Or to say, that the template system needs a subclass system.</span><br style="font-family: Helvetica; font-size: 12px;" class=""><span style="font-family: Helvetica; font-size: 12px;" class="">&nbsp;</span><br style="font-family: Helvetica; font-size: 12px;" class=""><span style="font-family: Helvetica; font-size: 12px;" class="">Optional&lt;UITableView&gt; should be the super type of Optional&lt;MyTableView&gt;</span><br style="font-family: Helvetica; font-size: 12px;" class=""><span style="font-family: Helvetica; font-size: 12px;" class="">Array&lt;UITableView&gt; should be the super type of Array&lt;MyTableView&gt;</span></div></div><div class="" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font-size: 16px; font-family: 'Myriad Set Pro', 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, Verdana, sans-serif; vertical-align: baseline; line-height: 1.4737em; color: rgb(51, 51, 51);"><br class=""></div><div class="" style="box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; line-height: 1.4737em;"><font color="#333333" face="Myriad Set Pro, Lucida Grande, Helvetica Neue, Helvetica, Arial, Verdana, sans-serif" size="3" class=""><a href="https://forums.developer.apple.com/message/101646#101646" class="">https://forums.developer.apple.com/message/101646#101646</a></font></div></div></div></div></div></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=""><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"></div></div></div></div></div></blockquote></div><div class=""><br class=""></div><div class=""><div class=""><br class=""></div></div><div class=""><br class=""></div><div class="">Thanks!</div><div class=""><br class=""></div><div class="">Jiannan, Cao</div><div class=""><br class=""></div><div class=""><br class=""></div></div></div></div></div></div></div></div></div></div><br class=""></div></blockquote><blockquote type="cite" class=""><div class=""><span class="">_______________________________________________</span><br class=""><span class="">swift-evolution mailing list</span><br class=""><span class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a></span><br class=""><span class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br class=""></div></blockquote></div></div></blockquote></div><br class=""></div></div></blockquote></div></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=""></body></html>