<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=""><br class=""><div><blockquote type="cite" class=""><div class="">Am 07.01.2016 um 20:26 schrieb Félix Cloutier &lt;<a href="mailto:felixcca@yahoo.ca" class="">felixcca@yahoo.ca</a>&gt;:</div><br class="Apple-interchange-newline"><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="">Given that it relies on variadic templates and non-type template arguments, this wouldn't be feasible in Swift at the moment</span></div></blockquote></div><br class=""><div class="">Having non-type template arguments (and the ability to operate on them at compile time) would make it possible to drop all that stuff modeling this in the type system with peano numbers like I tried. Much more simple!&nbsp;</div><div class=""><br class=""></div><div class="">This would reduce my example to the following (no need for variadic templates because I give each SI unit it fixed place in the parameter list — your idea of using variadic templates would probably allow to extend the system by new base units, though, and allow to cut down the long template parameter lists in the arithmetic functions which will grow longer with each base unit added in my example...):</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(88, 110, 117);" class="">// TODO: extend by more type parameters for the remaining SI units</div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(88, 110, 117);" class="">// missing language feature: non-type generic arguments, here: Int</div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">public</span> <span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">struct</span> Quantity&lt;Length = Int, Time = Int, Mass = Int&gt; : <span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">Equatable</span>, <span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">Comparable</span> {</div><p style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150); min-height: 15px;" class="">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">let</span> value: <span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">Double</span></div><p style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150); min-height: 15px;" class="">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">init</span>(<span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">_</span> value: <span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">Double</span>) {</div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class="">&nbsp; &nbsp; &nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">self</span>.<span style="font-variant-ligatures: no-common-ligatures; color: #d33682" class="">value</span> = value</div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class="">&nbsp; &nbsp; }</div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class="">}</div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150); min-height: 15px;" class=""><br class=""></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">public</span> <span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">func</span> ==&lt;L,T,M&gt;(lhs: <span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">Quantity</span>&lt;<span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">L</span>,<span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">T</span>,<span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">M</span>&gt;, rhs: <span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">Quantity</span>&lt;<span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">L</span>,<span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">T</span>,<span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">M</span>&gt;) -&gt; <span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">Bool</span> {</div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">return</span> lhs.<span style="font-variant-ligatures: no-common-ligatures; color: #d33682" class="">value</span> == rhs.<span style="font-variant-ligatures: no-common-ligatures; color: #d33682" class="">value</span></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class="">}</div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150); min-height: 15px;" class=""><br class=""></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">public</span> <span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">func</span> &lt;&lt;L,T,M&gt;(lhs: <span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">Quantity</span>&lt;<span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">L</span>,<span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">T</span>,<span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">M</span>&gt;, rhs: <span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">Quantity</span>&lt;<span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">L</span>,<span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">T</span>,<span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">M</span>&gt;) -&gt; <span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">Bool</span> {</div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">return</span> lhs.<span style="font-variant-ligatures: no-common-ligatures; color: #d33682" class="">value</span> &lt; rhs.<span style="font-variant-ligatures: no-common-ligatures; color: #d33682" class="">value</span></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class="">}</div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150); min-height: 15px;" class=""><br class=""></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">public</span> <span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">func</span> +&lt;L,T,M&gt;(lhs: <span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">Quantity</span>&lt;<span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">L</span>,<span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">T</span>,<span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">M</span>&gt;, rhs: <span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">Quantity</span>&lt;<span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">L</span>,<span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">T</span>,<span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">M</span>&gt;) -&gt; <span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">Quantity</span>&lt;<span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">L</span>,<span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">T</span>,<span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">M</span>&gt; {</div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">return</span> <span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">Quantity</span>&lt;<span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">L</span>,<span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">T</span>,<span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">M</span>&gt;(lhs.<span style="font-variant-ligatures: no-common-ligatures; color: #d33682" class="">value</span> + rhs.<span style="font-variant-ligatures: no-common-ligatures; color: #d33682" class="">value</span>)</div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class="">}</div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150); min-height: 15px;" class=""><br class=""></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(133, 153, 1);" class="">public<span style="font-variant-ligatures: no-common-ligatures; color: #839496" class=""> </span>func<span style="font-variant-ligatures: no-common-ligatures; color: #839496" class=""> *</span></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class="">&nbsp; &nbsp; &lt;L1,T1,M1,L2,T2,M2,L,T,M <span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">where</span> <span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">L</span> == <span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">L1</span>+L2, T == T1+T2, M == M1+M2&gt;</div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(181, 137, 1);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #839496" class="">&nbsp; &nbsp; (lhs: </span>Quantity<span style="font-variant-ligatures: no-common-ligatures; color: #839496" class="">&lt;</span>L1<span style="font-variant-ligatures: no-common-ligatures; color: #839496" class="">,</span>T1<span style="font-variant-ligatures: no-common-ligatures; color: #839496" class="">,</span>M1<span style="font-variant-ligatures: no-common-ligatures; color: #839496" class="">&gt;, rhs: </span>Quantity<span style="font-variant-ligatures: no-common-ligatures; color: #839496" class="">&lt;</span>L2<span style="font-variant-ligatures: no-common-ligatures; color: #839496" class="">,</span>T2<span style="font-variant-ligatures: no-common-ligatures; color: #839496" class="">,</span>M2<span style="font-variant-ligatures: no-common-ligatures; color: #839496" class="">&gt;) -&gt; </span>Quantity<span style="font-variant-ligatures: no-common-ligatures; color: #839496" class="">&lt;</span>L<span style="font-variant-ligatures: no-common-ligatures; color: #839496" class="">,</span>T<span style="font-variant-ligatures: no-common-ligatures; color: #839496" class="">,</span>M<span style="font-variant-ligatures: no-common-ligatures; color: #839496" class="">&gt;</span></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class="">{</div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">return</span> <span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">Quantity</span>&lt;<span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">L</span>,<span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">T</span>,<span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">M</span>&gt;(lhs.<span style="font-variant-ligatures: no-common-ligatures; color: #d33682" class="">value</span> * rhs.<span style="font-variant-ligatures: no-common-ligatures; color: #d33682" class="">value</span>)</div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class="">}</div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150); min-height: 15px;" class=""><br class=""></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(133, 153, 1);" class="">public<span style="font-variant-ligatures: no-common-ligatures; color: #839496" class=""> </span>func<span style="font-variant-ligatures: no-common-ligatures; color: #839496" class=""> /</span></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class="">&nbsp; &nbsp; &lt;L1,T1,M1,L2,T2,M2,L,T,M <span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">where</span> <span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">L</span> == <span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">L1</span>-L2, T == T1-T2, M == M1-M2&gt;</div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(181, 137, 1);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #839496" class="">&nbsp; &nbsp; (lhs: </span>Quantity<span style="font-variant-ligatures: no-common-ligatures; color: #839496" class="">&lt;</span>L1<span style="font-variant-ligatures: no-common-ligatures; color: #839496" class="">,</span>T1<span style="font-variant-ligatures: no-common-ligatures; color: #839496" class="">,</span>M1<span style="font-variant-ligatures: no-common-ligatures; color: #839496" class="">&gt;, rhs: </span>Quantity<span style="font-variant-ligatures: no-common-ligatures; color: #839496" class="">&lt;</span>L2<span style="font-variant-ligatures: no-common-ligatures; color: #839496" class="">,</span>T2<span style="font-variant-ligatures: no-common-ligatures; color: #839496" class="">,</span>M2<span style="font-variant-ligatures: no-common-ligatures; color: #839496" class="">&gt;) -&gt; </span>Quantity<span style="font-variant-ligatures: no-common-ligatures; color: #839496" class="">&lt;</span>L<span style="font-variant-ligatures: no-common-ligatures; color: #839496" class="">,</span>T<span style="font-variant-ligatures: no-common-ligatures; color: #839496" class="">,</span>M<span style="font-variant-ligatures: no-common-ligatures; color: #839496" class="">&gt;</span></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class="">{</div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">return</span> <span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">Quantity</span>&lt;<span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">L</span>,<span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">T</span>,<span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">M</span>&gt;(lhs.<span style="font-variant-ligatures: no-common-ligatures; color: #d33682" class="">value</span> / rhs.<span style="font-variant-ligatures: no-common-ligatures; color: #d33682" class="">value</span>)</div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class="">}</div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150); min-height: 15px;" class=""><br class=""></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150); min-height: 15px;" class=""><br class=""></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(88, 110, 117);" class="">// Defining some nice typealiases with which to work</div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150); min-height: 15px;" class=""><br class=""></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">public</span> <span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">typealias</span> Scalar &nbsp; = Quantity&lt;<span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">0</span>, <span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">0</span>, <span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">0</span>&gt; <span style="font-variant-ligatures: no-common-ligatures; color: #586e75" class="">// dimensionless</span></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">public</span> <span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">typealias</span> Length &nbsp; = Quantity&lt;<span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">1</span>, <span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">0</span>, <span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">0</span>&gt; <span style="font-variant-ligatures: no-common-ligatures; color: #586e75" class="">// meter</span></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">public</span> <span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">typealias</span> Time &nbsp; &nbsp; = Quantity&lt;<span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">0</span>, <span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">1</span>, <span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">0</span>&gt; <span style="font-variant-ligatures: no-common-ligatures; color: #586e75" class="">// seconds</span></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">public</span> <span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">typealias</span> Mass &nbsp; &nbsp; = Quantity&lt;<span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">0</span>, <span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">0</span>, <span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">1</span>&gt; <span style="font-variant-ligatures: no-common-ligatures; color: #586e75" class="">// kilogram</span></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">public</span> <span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">typealias</span> Velocity = Quantity&lt;<span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">1</span>, -<span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">1</span>, <span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">0</span>&gt; <span style="font-variant-ligatures: no-common-ligatures; color: #586e75" class="">// m/s</span></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">public</span> <span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">typealias</span> Newton &nbsp; = Quantity&lt;<span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">1</span>, -<span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">2</span>, <span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">1</span>&gt; <span style="font-variant-ligatures: no-common-ligatures; color: #586e75" class="">// m*kg/s^2</span></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150); min-height: 15px;" class=""><br class=""></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150); min-height: 15px;" class=""><br class=""></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(133, 153, 1);" class="">public<span style="font-variant-ligatures: no-common-ligatures; color: #839496" class=""> </span>extension<span style="font-variant-ligatures: no-common-ligatures; color: #839496" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">Double</span><span style="font-variant-ligatures: no-common-ligatures; color: #839496" class=""> {</span></div><p style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150); min-height: 15px;" class="">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">public</span> <span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">var</span> m: <span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">Length</span> {</div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class="">&nbsp; &nbsp; &nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">return</span> <span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">Length</span>(<span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">self</span>)</div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class="">&nbsp; &nbsp; }</div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">public</span> <span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">var</span> s: <span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">Time</span> {</div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class="">&nbsp; &nbsp; &nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">return</span> <span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">Time</span>(<span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">self</span>)</div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class="">&nbsp; &nbsp; }</div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">public</span> <span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">var</span> kg: <span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">Mass</span> {</div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class="">&nbsp; &nbsp; &nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">return</span> <span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">Mass</span>(<span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">self</span>)</div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class="">&nbsp; &nbsp; }</div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class="">}</div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150); min-height: 15px;" class=""><br class=""></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">let</span> dist = <span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">10</span>.<span style="font-variant-ligatures: no-common-ligatures; color: #d33682" class="">m</span> <span style="font-variant-ligatures: no-common-ligatures; color: #6c71c4" class="">+</span> <span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">5</span>.<span style="font-variant-ligatures: no-common-ligatures; color: #d33682" class="">m</span></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">let</span> time = <span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">20</span>.<span style="font-variant-ligatures: no-common-ligatures; color: #d33682" class="">s</span></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">let</span> mass = <span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">5</span>.<span style="font-variant-ligatures: no-common-ligatures; color: #d33682" class="">kg</span></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">let</span> velocity: <span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">Velocity</span> = <span style="font-variant-ligatures: no-common-ligatures; color: #d33682" class="">dist</span> <span style="font-variant-ligatures: no-common-ligatures; color: #6c71c4" class="">/</span> <span style="font-variant-ligatures: no-common-ligatures; color: #d33682" class="">time</span></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">let</span> force: <span style="font-variant-ligatures: no-common-ligatures; color: #b58901" class="">Newton</span> = <span style="font-variant-ligatures: no-common-ligatures; color: #d33682" class="">mass</span> <span style="font-variant-ligatures: no-common-ligatures; color: #6c71c4" class="">*</span> <span style="font-variant-ligatures: no-common-ligatures; color: #d33682" class="">dist</span> / (<span style="font-variant-ligatures: no-common-ligatures; color: #d33682" class="">time</span> <span style="font-variant-ligatures: no-common-ligatures; color: #6c71c4" class="">*</span> <span style="font-variant-ligatures: no-common-ligatures; color: #d33682" class="">time</span>)</div></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class=""><br class=""></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class=""><br class=""></div><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class=""><span style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px;" class="">-Thorsten</span></div></body></html>