<div>And, without integer literals as generic parameters, how would you express this operation?</div><div><br></div><div><br><div class="gmail_quote"><div>On Sat, Jun 17, 2017 at 23:01 David Sweeris &lt;<a href="mailto:davesweeris@mac.com">davesweeris@mac.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><br></div><div>On Jun 17, 2017, at 20:43, Xiaodi Wu &lt;<a href="mailto:xiaodi.wu@gmail.com" target="_blank">xiaodi.wu@gmail.com</a>&gt; wrote:<br><br></div><blockquote type="cite"><div>In Swift, all types and all operators are implemented in the standard library. How do you express the idea that, when you add values of disparate types T and U, the result should be of the type with greater precision? You need to be able to spell this somehow.</div>
</blockquote><br></div><div><div>Oh, ok... I thought you meant &quot;conditional conformance&quot; or something <i>concrete</i> :-D</div><div><br></div><div>Off the top of my head, with &quot;literals as generic parameters&quot;,</div><div>protocol Addable {</div><div>  associatedtype BitsOfPrecision: IntegerLiteral</div><div>  static func + &lt;T: Addable&gt; (_: Self, _: T) -&gt; T where T.<span style="background-color:rgba(255,255,255,0)">BitsOfPrecision &gt;</span></div><div><span style="background-color:rgba(255,255,255,0)">BitsOfPrecision</span></div><div><div><span style="background-color:rgba(255,255,255,0)">  static func + &lt;T: Addable&gt; (_: Self, _: T) -&gt; Self where T.BitsOfPrecision &lt;= </span><span style="background-color:rgba(255,255,255,0)">BitsOfPrecision</span></div></div><div><span style="background-color:rgba(255,255,255,0)">}</span></div><div><span style="background-color:rgba(255,255,255,0)"><br></span></div><div><span style="background-color:rgba(255,255,255,0)">Although, come to think of it, I suppose that&#39;s a bit more than simply using literals as types. Still, it&#39;s all information that&#39;s available at compile time, though.</span></div><div><span style="background-color:rgba(255,255,255,0)"><br></span></div><div><span style="background-color:rgba(255,255,255,0)">- Dave Sweeris </span></div></div></blockquote></div></div>