<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><blockquote type="cite" class="">Can't quite see where "Inheritance for structs / "newtype"-feature"<br class="">enables this, however. Care to explain?<br class=""></blockquote>It's not required, but unless you want to implement a completely new numeric type (like fractions), it is tedious to declare all operations and conversions that are useful or required:<div class=""><br class=""></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: #bb2ca2" class="">struct</span> CustomDouble {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span class="Apple-tab-span" style="white-space:pre">        </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">let</span> value: <span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Double</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; min-height: 13px;" class=""><br class=""></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: #bb2ca2" class="">func</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> == (a: </span>CustomDouble<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">, b: </span>CustomDouble<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">) -> </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Bool</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> {</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span class="Apple-tab-span" style="white-space:pre">        </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">return</span> <span style="font-variant-ligatures: no-common-ligatures; color: #3d1d81" class="">abs</span>(a.<span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">value</span> - b.<span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">value</span>) < <span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">0.01</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div></div><div class=""><br class=""></div><div class="">This type can handle the comparison, but actually, you don't want a struct that contains a double, but that is a double (and inherits all abilities of this type).</div><div class="">Greg Titus already did some research and made the observation that such simple container-types have no memory or performance penalty, but as a developer, you have to write many stupid functions that do nothing but forwarding operations on x to x.value…</div><div class=""><br class=""></div><div class="">Tino</div></body></html>