<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></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 Apr 28, 2016, at 6:20 PM, Xiaodi Wu <<a href="mailto:xiaodi.wu@gmail.com" class="">xiaodi.wu@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote">On Thu, Apr 28, 2016 at 6:44 PM, Erica Sadun <span dir="ltr" class=""><<a href="mailto:erica@ericasadun.com" target="_blank" class="">erica@ericasadun.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word" class=""><div class="">Can you give me a specific example of where this approach fails for you?</div><span class=""><font color="#888888" class=""><div class=""><br class=""></div><div class="">-- E</div></font></span></div></blockquote><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Sure, I'll describe one (renaming some things for clarity and stripping out the meat of the code, because it's not relevant and because it's not elegant)--</div><div class=""><br class=""></div><div class="">In one file, I have:</div><div class=""><br class=""></div><div class="">```</div><div class="">class PortedTransfom {</div><div class="">// this class was ported from C++</div><div class="">// it transforms input FP values to output values in a complicated way</div><div class="">// it's a standalone entity and the algorithm is even under patent</div><div class="">// (not owned by me, though it's legal for me to use it for my purposes)</div><div class="">// for this reason, this ported code lives in its own file</div><div class="">}</div><div class="">```</div><div class=""><br class=""></div><div class="">In another file, I have:</div><div class=""><br class=""></div><div class="">```</div><div class="">class MyAsinhTransform {</div><div class="">// this class was written by me</div><div class="">// nothing earth-shattering here</div><div class="">}</div><div class=""><br class=""></div><div class="">class MyLogTransform {</div><div class="">// also written by me</div><div class="">}</div><div class=""><br class=""></div><div class="">class MyLinearTransform {</div><div class="">// also written by me</div><div class="">}</div><div class="">```</div><div class=""><br class=""></div><div class="">Transforming values one-at-a-time isn't fast enough, so in another file, I have:</div><div class=""><br class=""></div><div class="">```</div><div class="">import Accelerate</div><div class=""><br class=""></div><div class="">protocol AcceleratedTransform {</div><div class=""> func scale(_: [Double]) -> [Double]</div><div class=""> func unscale(_: [Double]) -> [Double]</div><div class="">// other functions here</div><div class="">// some are already implemented in PortedTransform, though</div><div class="">}</div><div class="">extension AcceleratedTransform {</div><div class="">// default implementations for some functions</div><div class="">// but not `scale(_:)` and `unscale(_:)`, obviously</div><div class="">}</div><div class=""><br class=""></div><div class="">extension MyAsinhTransform : AcceleratedTransform {</div><div class="">// use BLAS to implement scale(_:) and unscale(_:)</div><div class="">// and override some default implementations<br class=""></div><div class="">}</div><div class=""><br class=""></div><div class="">extension MyLogTransform : AcceleratedTransform {</div><div class="">// use BLAS to implement scale(_:) and unscale(_:)</div><div class="">// and override some default implementations<br class=""></div><div class="">}<br class=""></div><div class=""><br class=""></div><div class="">extension MyLinearTransform : AcceleratedTransform {</div><div class=""><div class="">// use BLAS to implement scale(_:) and unscale(_:)</div><div class="">// and override some default implementations<br class=""></div><div class="">}<br class=""></div></div><div class=""><br class=""></div><div class="">extension PortedTransform : AcceleratedTransform {</div><div class="">// use BLAS to implement scale(_:) and unscale(_:)</div><div class="">}</div><div class="">```</div></div></div></div></div></blockquote><br class=""></div><div>I think I'm missing something here in terms of a question. Your imported stuff is your imported stuff.</div><div>Your extension implements "required" elements but not scale or unscale.</div><div><br class=""></div><div>If you extend MyAsinhTransform, you do required but not override for scale/unscale. You do required override for anything you replace from AcceleratedTransform.</div><div>What is BLAS? And what are you specifically asking about?</div><div><br class=""></div><div>-- E, apologizing for not understanding</div><br class=""></body></html>