<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="">I want to revisit some specific generics idea that, IIRC, were generally well-recieved at the time, but the conversation died down and nobody got around to writing formal proposals. I want to revisit them now (as opposed to in phase 2) because I don’t know how much “growing room” there is in the ABI for generics to gain features. It’d be a shame to close the door on these simply because nobody said anything. Anyway...<div class=""><br class=""></div><div class="">1) Allow generic parameters to have optional labels:&nbsp;<span style="font-family: Menlo; font-variant-ligatures: no-common-ligatures; color: rgb(187, 44, 162);" class="">struct</span><span style="font-family: Menlo; font-variant-ligatures: no-common-ligatures;" class=""> Array &lt;Element T&gt; {…} </span><span style="color: rgb(0, 132, 0); font-family: Menlo; font-variant-ligatures: no-common-ligatures;" class="">//`let x = Array&lt;Element: Double&gt;` Not the best example, though, since I’d definitely argue against adding a label here</span></div><div class="">2) Allow literals as generic arguments: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span style="font-family: Menlo; font-variant-ligatures: no-common-ligatures; color: rgb(187, 44, 162);" class="">struct</span><span style="font-family: Menlo; font-variant-ligatures: no-common-ligatures;" class=""> Array &lt;T, Length:&nbsp;<span style="color: rgb(112, 61, 170);" class="">Int</span>&gt; {…}&nbsp;</span><font color="#008400" face="Menlo" class="">//Allows for `let x = Array&lt;Double, Length: 10&gt;()`</font></div><div class="">3) Allow generic parameters to have default values: &nbsp;<span style="font-family: Menlo; font-variant-ligatures: no-common-ligatures; color: rgb(187, 44, 162);" class="">struct</span><span style="font-family: Menlo; font-variant-ligatures: no-common-ligatures;" class=""> Array &lt;T, Length:&nbsp;<span style="color: rgb(112, 61, 170);" class="">Int</span>, FixedSize:&nbsp;<span style="color: rgb(112, 61, 170);" class="">Bool</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;= </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(187, 44, 162);" class="">false</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&gt; {…}&nbsp;</span><font color="#008400" face="Menlo" class="">//The `let x…` from above still works, as well as `let y = Array&lt;Double, Length: 10, FixedSize: true&gt;()`</font></span></div><div class=""><span style="font-family: Menlo; font-variant-ligatures: no-common-ligatures;" class=""><font color="#008400" face="Menlo" class=""><br class=""></font></span></div><div class="">In addition to concerns regarding binary backwards compatibility, t<span style="font-variant-ligatures: no-common-ligatures;" class="">here’s one part where it might affect source code compatibility, too… If generic arguments get optional labels, would we need to use a `</span><span style="color: rgb(187, 44, 162); font-family: Menlo;" class="">_</span>` like with function arguments to indicate that we don’t intend for a label? Personally, I think a better solution would be to just make the labels be the same as the parameter name and have their use be optional altogether (except for parameters with default values — those would always need labels in case the type has several and you skip some), but perhaps others will feel differently.</div><div class=""><br class=""></div><div class="">Anyway, if this is phase 1 material, I’ll cheerfully get a informal proposal written up to kick off the discussion thread. If not, I’ll shelve them until phase 2.</div><div class=""><br class=""></div><div class="">- Dave Sweeris</div></body></html>