<div dir="ltr"><div class="markdown-here-wrapper" style=""><p style="margin:0px 0px 1.2em!important">Current alternative to default generic arguments is <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline">typealias</code>, like <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline">basic_string</code> and <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline">string</code> in C++:</p>
<pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline;white-space:pre;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block!important">struct BasicBigInt&lt;T&gt; { ... }
typealias BigInt = BasicBigInt&lt;Int64&gt;
</code></pre><p style="margin:0px 0px 1.2em!important">It’s not <em>that</em> ugly. It keeps type inference rules simpler, easier to understand and more explicit.<br>As someone noted, current type inference for generic initializers works satisfactory in 99% cases. Is it really worth it to try to cover 99.9% at the cost of complexity of type inference rules?</p>
<p style="margin:0px 0px 1.2em!important">On the other hand, in the wild, there may exist types with 3 or even more generic parameters that have sensible default values. [Research needed]<br>For such complex cases, I think, it makes sense to add default generic parameters <em>only</em> together with generic parameter labels.<br>Also, in such cases, functions on types could often help. And that story is even out of scope of Swift 4 Phase 2.</p>
<div title="MDH:Q3VycmVudCBhbHRlcm5hdGl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