<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 16, 2016, at 12:37 AM, Andrew Bennett <<a href="mailto:cacoyi@gmail.com" class="">cacoyi@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Thanks for the detailed response, very interesting and its helped improve my mental model. I think I may have misinterpreted the extent of the proposal. Good point with CoreGraphics, I was the memory layout rather than the public interface that I was thinking of, but perhaps my memory is out of date :)<div class=""><br class=""></div><div class="">I think the thing I was remembering is this sort of thing:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="color:rgb(187,44,162)" class="">public</span> <span style="color:rgb(187,44,162)" class="">struct</span> _opaque_pthread_t {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""> <span style="color:rgb(187,44,162)" class="">public</span> <span style="color:rgb(187,44,162)" class="">var</span> __sig: <span style="color:rgb(112,61,170)" class="">Int</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(112, 61, 170);" class=""><span style="" class=""> </span><span style="color:rgb(187,44,162)" class="">public</span><span style="" class=""> </span><span style="color:rgb(187,44,162)" class="">var</span><span style="" class=""> __cleanup_stack: </span>UnsafeMutablePointer<span style="" class=""><</span>__darwin_pthread_handler_rec<span style="" class="">></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class=""> </span><span style="color:rgb(187,44,162)" class="">public</span><span style="" class=""> </span><span style="color:rgb(187,44,162)" class="">var</span><span style="" class=""> __opaque: (</span><font color="#703daa" class="">Int8</font><span style="" class="">, </span><font color="#703daa" class="">Int8</font><span style="" class="">, </span><font color="#703daa" class="">Int8</font><span style="" class="">, </span><font color="#703daa" class="">Int8</font><span style="" class="">, </span><font color="#703daa" class="">...</font><span style="" class="">))</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><br class=""></div>But I think that's a pthread thing, and probably for fixed sized arrays too. </div></div></div></blockquote><div><br class=""></div><div>Yep, it’s fixed size arrays that are imported like that. We have no other way of modeling them in Swift right now.</div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="">Anyway tuples is for the other thread.<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><br class=""></div>If my assumptions were false and the original idea doesn't change the memory/performance overhead then I am all for it :)</div></div></div></blockquote><div><br class=""></div><div>In general, the only things in the current Swift implementation that are tagged with runtime type information are instances of classes in the heap, and values of protocol type. Everywhere else, the compiler knows the layout statically, or it is passed in separately from the data (ie generics).</div><div><br class=""></div><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><br class=""></div></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, Feb 16, 2016 at 5:24 PM, Slava Pestov <span dir="ltr" class=""><<a href="mailto:spestov@apple.com" target="_blank" class="">spestov@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><br class=""><div class=""><span class=""><blockquote type="cite" class=""><div class="">On Feb 15, 2016, at 11:46 PM, Andrew Bennett via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class=""><div class="">The same goes for tuples. At the moment a tuple is the closest thing to a c style struct. I think c structs are currently imported as tuples.</div></div></div></blockquote><div class=""><br class=""></div></span><div class="">Actually structs are imported as structs :-) (eg, import CoreGraphics - you get a CGPoint struct). We ask clang do the in-memory layout, but from a language perspective, they look mostly like normal Swift structs.</div><span class=""><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""> If you made it so (A,A) was interchangeable with (B,B) then they'd have to have the same size, and maybe also store type information where they may not otherwise.<br class=""></div></div></div></blockquote><div class=""><br class=""></div></span>That’s not a requirement for subtyping relations actually.</div><div class=""><br class=""></div><div class="">If A is a struct conforming to some protocol P, then values of type ‘A’ have a different runtime representation than values of type ‘P’, because the protocol value needs to attach the runtime type to the payload, whereas the struct will not. However, we still do an implicit conversion allowing As to be passed as Ps, we just generate the right code at the point where the conversion takes place. </div><div class=""><br class=""></div><div class="">Another example is when you have a function () -> A, the conversion to () -> P requires actually generating a thunk to wrap the original function value.</div><div class=""><br class=""></div><div class="">Subtyping in Swift is different from a pointer cast in C — its semantically producing a new value, so any representational change issues are orthogonal to the language itself. They leak out in the cases that are not implemented (we don’t do tuple conversions currently, and didn’t do function conversions until 2.1) but those will get plugged over time.</div><span class="HOEnZb"><font color="#888888" class=""><div class=""><br class=""></div><div class="">Slava</div></font></span><div class=""><div class="h5"><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><br class="">On Tuesday, 16 February 2016, Cao Jiannan via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">Also:<div class=""><br class=""></div><div class="">union(A,B,C) is subtype of union(A,B,C,D,…)</div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">在 2016年2月16日,14:36,Cao Jiannan <<a class="">frogcjn@163.com</a>> 写道:</div><br class=""><div class=""><div style="word-wrap:break-word" class=""><div class="">Hi all,</div><div class=""><br class=""></div><div class="">I think the best way to solve the either problem is to separate it from generic. </div><div class="">Optional and Either shouldn’t work the same way of generic type. </div><div class="">It’s just a represent of multiple type in one location.</div><div class=""><br class=""></div><div class="">Using an old friend, Union in C.</div><div class="">union {</div><div class=""><span style="white-space:pre-wrap" class="">        </span>case firstType</div><div class=""><span style="white-space:pre-wrap" class="">        </span>case secondType</div><div class="">}</div><div class=""><br class=""></div><div class="">This is the final solution for the sub typing problem of optional.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">A == union(A,A)</div><div class=""><div class="">union(A,B) == union(B,A)</div></div><div class="">B == union(B,B)</div><div class=""><br class=""></div><div class="">B is subtype of union(A,B)</div><div class="">A is subtype of union(A,B)</div><div class=""><br class=""></div><div class=""><div class="">suppose </div><div class="">a is subclass of A</div><div class="">b is subclass of B, then</div></div><div class=""><div class=""><span style="white-space:pre-wrap" class="">        </span>union(a,B) is subtype of union(A,B)</div><div class=""><span style="white-space:pre-wrap" class="">        </span>union(A,b) is subtype of union(A,B)</div></div><div class=""><div class=""><span style="white-space:pre-wrap" class="">        </span>union(a,b) is subtype of union(a,B)</div></div><div class=""><div class=""><span style="white-space:pre-wrap" class="">        </span>union(a,b) is subtype of union(A,b)</div></div><div class=""><br class=""></div><div class="">union can have as many case as possible. e.g., union(A,B,C,D,…)</div><div class=""><br class=""></div><div class="">So the Optional<UITableView> should be union(UITableView, None)</div><div class="">and Optional<MyTableVIew> should be union(MyTableView, None), which is subclass of union(UITableView, None)</div><div class=""><br class=""></div><div class="">This is a final rational solution. I think.</div><div class=""><br class=""></div><div class="">-Jiannan</div><div class=""><br class=""><blockquote type="cite" class=""><div class="">下面是被转发的邮件:</div><br class=""><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px" class=""><span style="font-family:-webkit-system-font,'Helvetica Neue',Helvetica,sans-serif" class=""><b class="">发件人: </b></span><span style="font-family:-webkit-system-font,Helvetica Neue,Helvetica,sans-serif" class="">Cao Jiannan via swift-evolution <<a class="">swift-evolution@swift.org</a>><br class=""></span></div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px" class=""><span style="font-family:-webkit-system-font,'Helvetica Neue',Helvetica,sans-serif" class=""><b class="">主题: </b></span><span style="font-family:-webkit-system-font,Helvetica Neue,Helvetica,sans-serif" class=""><b class="">[swift-evolution] Swift Generic Subtype Problem</b><br class=""></span></div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px" class=""><span style="font-family:-webkit-system-font,'Helvetica Neue',Helvetica,sans-serif" class=""><b class="">日期: </b></span><span style="font-family:-webkit-system-font,Helvetica Neue,Helvetica,sans-serif" class="">2016年2月16日 GMT+8 11:48:18<br class=""></span></div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px" class=""><span style="font-family:-webkit-system-font,'Helvetica Neue',Helvetica,sans-serif" class=""><b class="">收件人: </b></span><span style="font-family:-webkit-system-font,Helvetica Neue,Helvetica,sans-serif" class=""><a class="">swift-evolution@swift.org</a><br class=""></span></div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px" class=""><span style="font-family:-webkit-system-font,'Helvetica Neue',Helvetica,sans-serif" class=""><b class="">回复-收件人: </b></span><span style="font-family:-webkit-system-font,Helvetica Neue,Helvetica,sans-serif" class="">Cao Jiannan <<a class="">frogcjn@163.com</a>><br class=""></span></div><br class=""><div class=""><div style="word-wrap:break-word" 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" class=""><div class=""><span style="font-family:inherit;color:rgb(51,51,51);font-size:10pt;font-style:inherit" class="">I </span><font color="#333333" face="Helvetica Neue" size="2" style="font-family:'Helvetica Neue'" class="">want to discuss on a </font><span style="color:rgb(51,51,51);font-family:'Helvetica Neue';font-size:small" class="">problem</span> about <span style="font-family:'Helvetica Neue';color:rgb(51,51,51);font-size:small" class="">optional generic 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 style="word-wrap:break-word" class=""><div class=""><div class=""><div style="word-wrap:break-word" class=""><div class="">if B is subclass of A</div><div class="">Either<B,B> is subclass of Either<A,A>, Either<A,B>, Either<B,A></div><div class="">Either<B,A> is subclass of Either<A,A></div><div class=""><div class="">Either<A,B> is subclass of Either<A,A></div><div class=""><br class=""></div></div></div></div></div></div><blockquote type="cite" class=""><div style="word-wrap:break-word" class=""><div class=""><div class=""><div style="word-wrap:break-word" class=""><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" 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" class=""><div class=""><div class=""><div style="word-wrap:break-word" class=""><div class=""><div class=""><div style="word-wrap:break-word" class=""><div class=""><div style="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" class=""><div style="margin:0px;padding:0px 0px 0px 45px;border:0px;font-style:inherit;font-family:inherit;vertical-align:baseline" class=""><div style="margin:0px;padding:0px;border:0px;font-style:inherit;font-family:inherit;vertical-align:baseline" class=""></div></div><ol start="1" style="padding:0px;border:none;font-style:inherit;font-family:inherit;vertical-align:baseline;list-style-position:initial;background-color:rgb(255,255,255);color:rgb(92,92,92);margin:0px 0px 1px 45px!important" class=""><li style="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;min-height:12pt;white-space:nowrap;margin:0px!important;padding:0px 3px 0px 10px!important" class=""><span style="margin:0px;padding:0px;border:0px;font-style:inherit;vertical-align:baseline;background-color:inherit;font-size:9pt!important" class="">protocol SegueHandlerType { </span></li><li style="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);min-height:12pt;white-space:nowrap;margin:0px!important;padding:0px 3px 0px 10px!important" class=""><span style="margin:0px;padding:0px;border:0px;font-style:inherit;vertical-align:baseline;background-color:inherit;font-size:9pt!important" class=""> var tableView: UITableView! { get } </span></li><li style="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;min-height:12pt;white-space:nowrap;margin:0px!important;padding:0px 3px 0px 10px!important" class=""><span style="margin:0px;padding:0px;border:0px;font-style:inherit;vertical-align:baseline;background-color:inherit;font-size:9pt!important" class="">} </span></li></ol></div><div style="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)" class=""><br class=""></div><div style="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)" class=""><span style="margin:0px;padding:0px;border:0px;font-style:inherit;font-size:10pt;font-family:inherit;vertical-align:baseline" class="">so the UITableViewController can conform to the protocal</span></div><div style="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" class=""><div style="margin:0px;padding:0px 0px 0px 45px;border:0px;font-style:inherit;font-family:inherit;vertical-align:baseline" class=""><div style="margin:0px;padding:0px;border:0px;font-style:inherit;font-family:inherit;vertical-align:baseline" class=""></div></div><ol start="1" style="padding:0px;border:none;font-style:inherit;font-family:inherit;vertical-align:baseline;list-style-position:initial;background-color:rgb(255,255,255);color:rgb(92,92,92);margin:0px 0px 1px 45px!important" class=""><li style="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;min-height:12pt;white-space:nowrap;margin:0px!important;padding:0px 3px 0px 10px!important" class=""><span style="margin:0px;padding:0px;border:0px;font-style:inherit;vertical-align:baseline;background-color:inherit;font-size:9pt!important" class="">extension UITableViewController : SegueHandlerType { </span></li><li style="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);min-height:12pt;white-space:nowrap;margin:0px!important;padding:0px 3px 0px 10px!important" class=""><span style="margin:0px;padding:0px;border:0px;font-style:inherit;vertical-align:baseline;background-color:inherit;font-size:9pt!important" class="">} </span></li></ol></div><div style="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)" class=""><span style="margin:0px;padding:0px;border:0px;font-style:inherit;font-size:10pt;font-family:inherit;vertical-align:baseline" class=""><br class=""></span></div><div style="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)" class=""><span style="margin:0px;padding:0px;border:0px;font-style:inherit;font-size:10pt;font-family:inherit;vertical-align:baseline" class="">It's great!</span></div><div style="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)" class=""><span style="margin:0px;padding:0px;border:0px;font-style:inherit;font-size:10pt;font-family:inherit;vertical-align:baseline" class="">What if the tableView is a subclass UITableView?</span></div><div style="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)" class=""><span style="margin:0px;padding:0px;border:0px;font-style:inherit;font-size:10pt;font-family:inherit;vertical-align:baseline" class="">like:</span></div><div style="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" class=""><div style="margin:0px;padding:0px 0px 0px 45px;border:0px;font-style:inherit;font-family:inherit;vertical-align:baseline" class=""><div style="margin:0px;padding:0px;border:0px;font-style:inherit;font-family:inherit;vertical-align:baseline" class=""></div></div><ol start="1" style="padding:0px;border:none;font-style:inherit;font-family:inherit;vertical-align:baseline;list-style-position:initial;background-color:rgb(255,255,255);color:rgb(92,92,92);margin:0px 0px 1px 45px!important" class=""><li style="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;min-height:12pt;white-space:nowrap;margin:0px!important;padding:0px 3px 0px 10px!important" class=""><span style="margin:0px;padding:0px;border:0px;font-style:inherit;vertical-align:baseline;background-color:inherit;font-size:9pt!important" class="">class MyTableView : UITableView {</span></li><li style="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;min-height:12pt;white-space:nowrap;margin:0px!important;padding:0px 3px 0px 10px!important" class=""><span style="margin:0px;padding:0px;border:0px;font-style:inherit;vertical-align:baseline;background-color:inherit;font-size:9pt!important" class="">}</span></li><li style="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;min-height:12pt;white-space:nowrap;margin:0px!important;padding:0px 3px 0px 10px!important" class=""><span style="margin:0px;padding:0px;border:0px;font-style:inherit;vertical-align:baseline;background-color:inherit;font-size:9pt!important" class=""><br class=""></span></li><li style="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;min-height:12pt;white-space:nowrap;margin:0px!important;padding:0px 3px 0px 10px!important" class=""><span style="margin:0px;padding:0px;border:0px;font-style:inherit;vertical-align:baseline;background-color:inherit;font-size:9pt!important" class="">MyTableViewController { </span></li><li style="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);min-height:12pt;white-space:nowrap;margin:0px!important;padding:0px 3px 0px 10px!important" class=""><span style="margin:0px;padding:0px;border:0px;font-style:inherit;vertical-align:baseline;background-color:inherit;font-size:9pt!important" class=""> <span style="margin:0px;padding:0px;border:0px;font-style:inherit;vertical-align:baseline;color:rgb(100,100,100);background-color:inherit;font-size:9pt!important" class="">@IBOutlet</span><span style="margin:0px;padding:0px;border:0px;font-style:inherit;vertical-align:baseline;background-color:inherit;font-size:9pt!important" class=""> var tableView: MyTableView! </span></span></li><li style="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);min-height:12pt;white-space:nowrap;margin:0px!important;padding:0px 3px 0px 10px!important" class=""><span style="margin:0px;padding:0px;border:0px;font-style:inherit;vertical-align:baseline;background-color:inherit;font-size:9pt!important" class="">} </span></li></ol></div><div style="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)" class=""><br class=""></div><div style="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)" class=""><span style="margin:0px;padding:0px;border:0px;font-style:inherit;font-size:10pt;font-family:inherit;vertical-align:baseline" class="">Then </span></div><div style="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" class=""><div style="margin:0px;padding:0px 0px 0px 45px;border:0px;font-style:inherit;font-family:inherit;vertical-align:baseline" class=""><div style="margin:0px;padding:0px;border:0px;font-style:inherit;font-family:inherit;vertical-align:baseline" class=""></div></div><ol start="1" style="padding:0px;border:none;font-style:inherit;font-family:inherit;vertical-align:baseline;list-style-position:initial;background-color:rgb(255,255,255);color:rgb(92,92,92);margin:0px 0px 1px 45px!important" class=""><li style="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;min-height:12pt;white-space:nowrap;margin:0px!important;padding:0px 3px 0px 10px!important" class=""><span style="margin:0px;padding:0px;border:0px;font-style:inherit;vertical-align:baseline;background-color:inherit;font-size:9pt!important" class="">extension MyTableViewController:SegueHandlerType { </span></li><li style="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);min-height:12pt;white-space:nowrap;margin:0px!important;padding:0px 3px 0px 10px!important" class=""><span style="margin:0px;padding:0px;border:0px;font-style:inherit;vertical-align:baseline;background-color:inherit;font-size:9pt!important" class=""> </span></li><li style="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;min-height:12pt;white-space:nowrap;margin:0px!important;padding:0px 3px 0px 10px!important" class=""><span style="margin:0px;padding:0px;border:0px;font-style:inherit;vertical-align:baseline;background-color:inherit;font-size:9pt!important" class="">} </span></li></ol></div><div style="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" class=""><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=""> </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=""> </span><br style="font-family:Helvetica;font-size:12px" class=""><span style="font-family:Helvetica;font-size:12px" class="">Optional<UITableView> should be the super type of Optional<MyTableView></span><br style="font-family:Helvetica;font-size:12px" class=""><span style="font-family:Helvetica;font-size:12px" class="">Array<UITableView> should be the super type of Array<MyTableView></span></div></div><div style="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)" class=""><br class=""></div><div style="margin:0px;padding:0px;border:0px;vertical-align:baseline;line-height:1.4737em" class=""><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" target="_blank" class="">https://forums.developer.apple.com/message/101646#101646</a></font></div></div></div></div></div></div><blockquote type="cite" class=""><div class=""><div style="word-wrap:break-word" class=""><div class=""><div class=""><div style="word-wrap:break-word" class=""></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>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class=""></div></div></blockquote></div><br class=""></div></div></blockquote></div>
</div>
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></div>
</div></blockquote></div><br class=""></body></html>