<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=""><div><blockquote type="cite" class=""><div class="">On 7 Jan 2016, at 23:51, James Campbell via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="" style="font-family: HelveticaNeue;">Yes that is the main purpose. At least 2 of the solutions define protocols which at the very least may be useful to have in the standard library.</div><div class="gmail_extra" style="font-family: HelveticaNeue;"><br class=""><div class="gmail_quote">On Thu, Jan 7, 2016 at 3:29 PM, Matthew Johnson <span dir="ltr" class=""><<a href="mailto:matthew@anandabits.com" target="_blank" class="">matthew@anandabits.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div class="" style="word-wrap: break-word;"><br class=""><div class=""><span class=""><blockquote type="cite" class=""><div class="">On Jan 7, 2016, at 9:01 AM, James Campbell via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class="" style="font-family: Helvetica; font-size: 12px;">Interesting could you upload :) would be good to consolidate all the approaches we have right now so we can come up with the best one:<div class=""><br class=""></div><div class="">So far we have:</div><div class=""><br class=""></div><div class="">- Box/Unit Type Protocol (My Solution)</div><div class="">- Math Group Protocol (Tino Heth)</div><div class="">- Computed typealias (John Randolph)</div></div><div class="gmail_extra" style="font-family: Helvetica; font-size: 12px;"><br class=""></div></div></blockquote><div class=""><br class=""></div></span><div class="">Is the goal of looking at approaches that are possible in the existing language to identify how the language could be improved to better facilitate type safe calculations? That seems relevant for this list. But if you get too far into collaborating on solutions you want to use today, that might be a conversation for the swift-users list.</div></div></div></blockquote></div></div></div></blockquote></div><div class="">[snip] </div><div class=""><br class=""></div><div class="">Hi all,</div><div class=""><br class=""></div><div class="">I too have been mulling these ideas over for some time (well before this thread or list started!), but busy yak shaving stuff right now :-/ (hence the list-lurking behaviour...)</div><div class=""><br class=""></div><div class="">In the meantime, I'd suggest looking at the way Mathematica approaches this issue - it's supported units, quantities, multiple standard systems and conversions, and a lot more - and has done so for 20+ years now.</div><div class=""><br class=""></div><div class="">When I free up some time, I plan to see what I can do with Swift lib on this front, but I'd suggest taking a look at Wolfram's "prior work" if this area is of interest to you: <a href="https://reference.wolfram.com/language/ref/Quantity.html" class="">https://reference.wolfram.com/language/ref/Quantity.html</a></div><div class=""><br class=""></div><div class="">There's also this by Martin Fowler on "quantity" types: <a href="http://martinfowler.com/eaaDev/quantity.html" class="">http://martinfowler.com/eaaDev/quantity.html</a></div><div class=""><br class=""></div><div class="">Sidebar on decimal numerics since they're relevant to support for currency units - would be nice to know if the "new" IEEE 754 (2008) Decimal floating-point types are in the Swift roadmap?</div><div class="">My suspicion is that any support for them will only come from upstream in LLVM as a first-class type [quad precision/binary128 is supported as the fp128 type; but no decimal floating-point types at present] - so looks like any fixed-point decimal support in the interim would need to be provided by hacking int types, but if anyone wants to chime in... :-)</div><div class=""><br class=""></div><div class="">Cheers,</div><div class="">M.</div><div class="">
<div style="font-family: Consolas, monospace; font-size: 14px; orphans: 2; widows: 2;" class="">-- </div><div style="font-family: Consolas, monospace; font-size: 14px; orphans: 2; widows: 2;" class="">Mark Glossop</div><div style="font-family: Consolas, monospace; font-size: 14px; orphans: 2; widows: 2;" class=""><b class="">E:</b> <a href="mailto:lists@cueballcentral.com" class="">lists</a><a href="mailto:tech@cueballcentral.com" class="">@cueballcentral.com</a></div><div style="font-family: Consolas, monospace; font-size: 14px; orphans: 2; widows: 2;" class=""><b class="">TW:</b> <a href="http://twitter.com/Cueball_AU" class="">http://twitter.com/Cueball_AU</a></div></div></body></html>