<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="">On Apr 28, 2016, at 8:11 PM, Xiaodi Wu <<a href="mailto:xiaodi.wu@gmail.com" class="">xiaodi.wu@gmail.com</a>> wrote:<br class=""><div><blockquote type="cite" class=""><br class=""><div class=""><div dir="ltr" style="font-family: Palatino-Roman; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_extra">Sorry, stripped out a little too much, I guess. Let me expand a little:</div><div class="gmail_extra"><br class=""></div><div class="gmail_extra">In this example, `PortedTransform` has, by virtue of how it works, an upper bound and lower bound for valid input (among other interesting methods and properties). Exceed those bounds for your input and `PortedTransform` regurgitates garbage but does not throw any kind of error. Obviously, linear transform does not care about such silly things because it can transform essentially any FP input value, while the log transform simply traps when it encounters a negative value (which, as a precondition, it should never encounter).</div><div class="gmail_extra"><br class=""></div><div class="gmail_extra">BLAS is an accelerated linear algebra library; Apple has implemented a very nicely optimized one as part of its Accelerate framework. I use BLAS to sum, for example, two arrays of floating point values--it's very, very highly optimized. In that situation, there's no trapping when a single value is out of bounds (I get NaNs instead), and thus I must determine bounds in order to anticipate when the output will be garbage or NaN. (There are, as part of the Accelerate framework, accelerated functions to clamp entire arrays to given bounds with maximal efficiency).</div><div class="gmail_extra"><br class=""></div><div class="gmail_extra">For accelerated scaling and unscaling, then, it is essentially always necessary to compute upper and lower bounds even when that's unnecessary for non-accelerated scaling and unscaling, which operates on one value at a time. For that reason, `AcceleratedTransform` requires methods that compute upper and lower bounds, and provides a default implementation of accelerated clamping that calls those bound-computing methods and then uses the results as parameters when calling functions in Accelerate.framework. Methods for the computation of bounds already exist in `PortedTransform` but not in my own transforms. With your proposal, how would I retroactively model this requirement without touching code for `PortedTransform` and without compiling this one class into its own library? I'd like to be able to take advantage of the maximum possible compiler optimization, and optimizing across module boundaries is (as far as I understand) a little dicier. (Moreover, for MyLinTransform, I override the clamping method to return the input without calling out to any framework functions because I know a priori that the bounds are -infinity and infinity. I think that override will still be possible under your proposal, though.)</div></div></div></blockquote></div><br class=""><div class="">Without actually trying to understand the details of your math stuff:</div><div class=""><br class=""></div><div class="">* If you add a required member in a declaration or extension that declares conformance, it is 'required'. </div><div class="">* If it is already defaulted, it is `override required`. </div><div class="">* If it is already defaulted but not required, it is `override`</div><div class="">* If someone else implements the stuff, you still have to pull it in somehow, but if you do so by conforming to another protocol with an extension, it's not your business, so you don't use any keywords.</div><div class=""><br class=""></div><div class="">You use keywords only for stuff that you specifically write, that clarifies the context in which you are writing it. If you do not own a protocol, an extension, or an implementation, you do not change or markup the protocol, extension, or implementation. You're just offering the compiler hints that your otherwise questionable decisions are fully intentional: when overriding an existing implementation and when conforming by supplying a required member.</div><div class=""><br class=""></div><div class="">-- E, who still probably missed your point and again apologizes</div><div class=""><br class=""></div><div class=""><br class=""></div></body></html>