<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"><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=""><pre style="white-space: pre-wrap; background-color: rgb(255, 255, 255);" class=""><blockquote type="cite" class=""><i class="">
</i><i class=""> One could workaround the problem and use final, but what if the class
</i><i class=""> meant to be subtypeable? Self simply does not work in this scenario.
</i><i class="">
</i>
It works exactly as it should in this scenario. If A isn't final, then by
definition it's impossible for A to make a copy of type Self. I see,
however, what you mean, which is that you wish you could write a protocol
requirement for a function that returns #Self.
</blockquote></pre><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(146, 146, 146);" class=""><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px;" class="">What do you mean? Even with the limited `Self` support in Swift 3, I can write a very effective copying paradigm.</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px;" class=""></div></span></div></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #008f01" class=""><pre class="" style="color: rgb(0, 0, 0); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 0.94em; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); border: 1px solid rgb(204, 204, 204); white-space: pre-wrap; word-wrap: break-word; padding: 5px;"><div style="font-family: Helvetica; font-size: 12px; white-space: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">protocol</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> Copyable</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">{</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">func</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> copy() -> </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(170, 46, 184);" class="">Self</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">class</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> Building: </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(95, 174, 174);" class="">Copyable</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">{</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">var</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> floors = </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(218, 32, 0);" class="">1</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span></span><br class="webkit-block-placeholder"></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 143, 1);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">required</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class=""> </span><span style="font-variant-ligatures: no-common-ligatures;" class="">init</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">()</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">                </span>{ }</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span></span><br class="webkit-block-placeholder"></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">func</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> copy() -> </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(170, 46, 184);" class="">Self</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>{</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">                </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">let</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> dynamicType = type(of: </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">self</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">                </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">let</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> newObject = dynamicType.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">init</span><span style="font-variant-ligatures: no-common-ligatures;" class="">()</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">                </span>newObject.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(79, 129, 135);" class="">floors</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> = </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">self</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(79, 129, 135);" class="">floors</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">                </span></span><br class="webkit-block-placeholder"></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">                </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">return</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> newObject</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">class</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> Mansion: </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(95, 174, 174);" class="">Building</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">{</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">var</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> butlers = </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(218, 32, 0);" class="">3</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span></span><br class="webkit-block-placeholder"></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">override</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">func</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> copy() -> </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(170, 46, 184);" class="">Self</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>{</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(146, 146, 146);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">//<span class="Apple-tab-span" style="white-space: pre;">        </span>let newObject = super.copy()</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">                </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">let</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> newObject = </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">super</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(49, 89, 93);" class="">copy</span><span style="font-variant-ligatures: no-common-ligatures;" class="">() </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">as</span><span style="font-variant-ligatures: no-common-ligatures;" class="">! </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(95, 174, 174);" class="">Mansion</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">                </span></span><br class="webkit-block-placeholder"></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">                </span>newObject.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(79, 129, 135);" class="">butlers</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> = </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">self</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(79, 129, 135);" class="">butlers</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">                </span></span><br class="webkit-block-placeholder"></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(146, 146, 146);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">//<span class="Apple-tab-span" style="white-space: pre;">        </span>return newObject</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">                </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">return</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(61, 29, 129);" class="">unsafeBitCast</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(newObject, to: type(of: </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">self</span><span style="font-variant-ligatures: no-common-ligatures;" class="">))</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">let</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> hoboHouse = </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(95, 174, 174);" class="">Building</span><span style="font-variant-ligatures: no-common-ligatures;" class="">()</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">hoboHouse</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">.</span><span style="font-variant-ligatures: no-common-ligatures;" class="">floors</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class=""> = </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(218, 32, 0);" class="">0</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">let</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> beggarHouse = </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(79, 129, 135);" class="">hoboHouse</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(49, 89, 93);" class="">copy</span><span style="font-variant-ligatures: no-common-ligatures;" class="">()</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(61, 29, 129);" class="">print</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">(</span><span style="font-variant-ligatures: no-common-ligatures;" class="">beggarHouse</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">.</span><span style="font-variant-ligatures: no-common-ligatures;" class="">floors</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">) </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(146, 146, 146);" class="">// "0"</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">let</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> myHouse = </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(95, 174, 174);" class="">Mansion</span><span style="font-variant-ligatures: no-common-ligatures;" class="">()</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">myHouse</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">.</span><span style="font-variant-ligatures: no-common-ligatures;" class="">floors</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class=""> = </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(218, 32, 0);" class="">4</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">let</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> yourHouse = </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(79, 129, 135);" class="">myHouse</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(49, 89, 93);" class="">copy</span><span style="font-variant-ligatures: no-common-ligatures;" class="">()</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(61, 29, 129);" class="">print</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">(</span><span style="font-variant-ligatures: no-common-ligatures;" class="">yourHouse</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">.</span><span style="font-variant-ligatures: no-common-ligatures;" class="">floors</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">) </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(146, 146, 146);" class="">// “4”</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(146, 146, 146);" class=""><br class=""></span></div></div></pre><div class=""><span style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px;" class="">Besides the poor support for `Self` in the function body (SE–0068 fixes that), it seems like an acceptable way of doing it.</span></div></span></div></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #929292" class=""><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px;" class=""><br class=""></div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px;" class="">Of course, I would love being able to use an initializer setup, but there are serious bugs in the implementation.</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px;" class=""><br class=""></div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px;" class=""><pre class="" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 0.94em; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); border: 1px solid rgb(204, 204, 204); white-space: pre-wrap; word-wrap: break-word; padding: 5px;"><div style="white-space: normal; font-family: Helvetica; font-size: 12px;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 143, 1);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">protocol</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class=""> Clonable</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">{</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">init</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(other: </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(73, 134, 114);" class="">Self</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 143, 1);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">extension</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(95, 174, 174);" class="">Clonable</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">{</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">func</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> clone() -> </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(73, 134, 114);" class="">Self</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">                </span>{ </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">return</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> type(of: </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">self</span><span style="font-variant-ligatures: no-common-ligatures;" class="">).</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">init</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(other: </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">self</span><span style="font-variant-ligatures: no-common-ligatures;" class="">) }</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(95, 174, 174);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">class</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class=""> Base: </span><span style="font-variant-ligatures: no-common-ligatures;" class="">Clonable</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">{</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">var</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> x: </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(91, 38, 153);" class="">Int</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span></span><br class="webkit-block-placeholder"></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">init</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(x: </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(91, 38, 153);" class="">Int</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">                </span>{ </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">self</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(79, 129, 135);" class="">x</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> = x }</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span></span><br class="webkit-block-placeholder"></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 143, 1);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">required</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class=""> </span><span style="font-variant-ligatures: no-common-ligatures;" class="">init</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">(other: </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(95, 174, 174);" class="">Base</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">                </span>{ </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">self</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(79, 129, 135);" class="">x</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> = other.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(79, 129, 135);" class="">x</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> }</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">class</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> Derived: </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(95, 174, 174);" class="">Base</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">{</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(91, 38, 153);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">var</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class=""> y: </span><span style="font-variant-ligatures: no-common-ligatures;" class="">String</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span></span><br class="webkit-block-placeholder"></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">init</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(x: </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(91, 38, 153);" class="">Int</span><span style="font-variant-ligatures: no-common-ligatures;" class="">, y: </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(91, 38, 153);" class="">String</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>{</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">                </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">self</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(79, 129, 135);" class="">y</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> = y</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">                </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">super</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">init</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(x: x)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span></span><br class="webkit-block-placeholder"></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(146, 146, 146);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">// Should be required by the Clonable protocol, but it isn't.</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 143, 1);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">required</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class=""> </span><span style="font-variant-ligatures: no-common-ligatures;" class="">init</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">(other: </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(95, 174, 174);" class="">Derived</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>{</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">                </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">self</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(79, 129, 135);" class="">y</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> = other.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(79, 129, 135);" class="">y</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">                </span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">super</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">init</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(other: other)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span></span><br class="webkit-block-placeholder"></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(146, 146, 146);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">// Required because it was `required` in Base. Even a `Derived` calls this initializer to clone, which is wrong. Bugs abound.</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 143, 1);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">required</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class=""> </span><span style="font-variant-ligatures: no-common-ligatures;" class="">init</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">(other: </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(95, 174, 174);" class="">Base</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(2, 37, 188);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class=""><span class="Apple-tab-span" style="white-space: pre;">                </span>{ </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(61, 29, 129);" class="">fatalError</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">(</span><span style="font-variant-ligatures: no-common-ligatures;" class="">"init(other:) is wrong."</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">) }</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">let</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> me = </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(95, 174, 174);" class="">Derived</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(x: </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(218, 32, 0);" class="">1</span><span style="font-variant-ligatures: no-common-ligatures;" class="">, y: </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(2, 37, 188);" class="">"food"</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(146, 146, 146);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 1);" class="">let</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class=""> alienClone = </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(79, 129, 135);" class="">me</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(49, 89, 93);" class="">clone</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 0, 0);" class="">() </span><span style="font-variant-ligatures: no-common-ligatures;" class="">// "init(other:) is wrong."</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><br class=""></span></div></div></pre></div></span></div></body></html>