<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><br class=""><blockquote type="cite" class=""><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: 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; float: none; display: inline !important;" class="">Yes, care needs to be taken about the associativity and commutativity of multiplication of units, but that's not too hard either, it basically amounts to some pattern matching along with symbolic computations respecting algebraic identities (think of it as a compile-time "unit interpreter") and maybe some post-normalization.</span></div></blockquote></div>I agree: "doing it right" is no rocket science (pun intended ;-) — but I'm quite sure it won't be possible unless the macro-system that might be introduced with Swift 4 is ready.<div class="">But there are possible workarounds for the lack metaprogramming the type system, so products with three or four factors should be possible without even changing the compiler (it will be ugly, though):</div><div class="">It is easy to define +/- for composed units, but it is a huge amount of code that has to be generated for all permutations.</div><div class=""><br class=""></div><div class="">@Tim Hawkins:</div><div class="">Thanks for posting the link — although it reminds me on feeling bad for not being in Hamburg right now ;-)</div><div class=""></div></body></html>