<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=""><div><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Just wanted to expand on the type tolerances idea with an example:</div><div class=""><br class=""></div><div class=""><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>let a:Float±0.1 = 1234.56</font></div><div class=""><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>let b:Float±0.5 = 123.456</font></div><div class=""><font face="Monaco" class=""><br class=""></font></div><div class=""><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>let result:Float±0.25 = a + b // Error as b’s tolerance > 0.25</font></div></div></div></blockquote></div>That example is a good motivation for two things I would like to see in Swift:<div class="">- Generic value parameters (has been proposed, but lacks traction)</div><div class="">- Inheritance for structs / "newtype"-feature (should have been proposed weeks ago…)</div><div class=""><br class=""></div><div class="">With both things available, it would be possible to implement your example with a slightly different syntax:</div><div class="">let a: FloatNumber<tolerance: 0.1> = 1234.56</div><div class=""><br class=""></div><div class="">Better support for plain simple calculations would be really cool — I still remember how impressed I've been the first time I saw the Scheme-Interpreter printing a number that filled the whole screen ;-)</div><div class=""><br class=""></div><div class="">Tino</div></body></html>