<div dir="ltr"><div class="gmail_msg" style="font-size:13px"><i>Yeah, this makes sense. Presumably this means that one could also write</i></div><div class="gmail_msg" style="font-size:13px"><i><br class="gmail_msg"></i></div><div class="gmail_msg" style="font-size:13px"><i><span class="inbox-m_2778705408532542046Apple-tab-span gmail_msg" style="white-space:pre-wrap">        </span>foo&lt;&gt;(1)</i></div><div class="gmail_msg" style="font-size:13px"><i><br class="gmail_msg"></i></div><div class="gmail_msg" style="font-size:13px"><i>where everything is still deduced. In C++, this syntax exists and means that non-template functions named “foo” are ignored.</i></div><div><br></div><div>Yes, it means so. One could have:</div><div><br></div><div><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">foo()</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">foo&lt;&gt;()         </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,143,0)">// redundant</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">foo&lt;</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">_</span><span style="font-variant-ligatures:no-common-ligatures">&gt;()        </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,143,0)">// redundant</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">foo&lt;</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">T</span><span style="font-variant-ligatures:no-common-ligatures">&gt;()</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">foo&lt;</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">_</span><span style="font-variant-ligatures:no-common-ligatures">, </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">_</span><span style="font-variant-ligatures:no-common-ligatures">&gt;()     </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,143,0)">// redundant</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">foo&lt;<span style="color:rgb(52,149,175)">T</span>, </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">_</span><span style="font-variant-ligatures:no-common-ligatures">&gt;()     </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,143,0)">// redundant</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">foo&lt;</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">_</span><span style="font-variant-ligatures:no-common-ligatures">, <font color="#3495af">U</font>&gt;()</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">foo&lt;<span style="color:rgb(52,149,175)">T</span>, <font color="#3495af">U</font>&gt;()</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures"><span style="color:rgb(0,143,0)">//..</span><br></span></p></div><div><br></div><div>One historical reason to allow redundant cases has been to ease automatic code generation.</div><div><br></div><div><div class="gmail_msg" style="font-size:13px"><i>This could be a more general feature that works wherever a type is specified and deduction works. For example, today you can do, e.g,</i></div><div class="gmail_msg" style="font-size:13px"><i><br class="gmail_msg"></i></div><div class="gmail_msg" style="font-size:13px"><i><span class="inbox-m_2778705408532542046Apple-tab-span gmail_msg" style="white-space:pre-wrap">        </span>let d1: Dictionary = [ “Hello” : 2017 ]</i></div><div class="gmail_msg" style="font-size:13px"><i><br class="gmail_msg"></i></div><div class="gmail_msg" style="font-size:13px"><i>and we’ll infer the type arguments. It wouldn’t be unreasonable to allow </i></div><div class="gmail_msg" style="font-size:13px"><i><br class="gmail_msg"></i></div><div class="gmail_msg" style="font-size:13px"><div class="gmail_msg"><i><span class="inbox-m_2778705408532542046Apple-tab-span gmail_msg" style="white-space:pre-wrap">        </span>let d2: Dictionary&lt;_, Int32&gt; = [ “Hello”: 2017 ]</i></div><div class="gmail_msg"><i><br class="gmail_msg"></i></div><div class="gmail_msg"><i>or</i></div><div class="gmail_msg"><i><br class="gmail_msg"></i></div><div class="gmail_msg"><div class="gmail_msg"><i><span class="inbox-m_2778705408532542046Apple-tab-span gmail_msg" style="white-space:pre-wrap">        </span>let d3: [ _: Int32 ] = [ “Hello”: 2017 ]</i></div></div><div class="gmail_msg"><i><br class="gmail_msg"></i></div><div class="gmail_msg"><i>or </i></div><div class="gmail_msg"><i><br class="gmail_msg"></i></div><div class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg"><i><span class="inbox-m_2778705408532542046Apple-tab-span gmail_msg" style="white-space:pre-wrap">        </span>let d4 = [ “Hello”: 2017 ] as [ _: Int32 ]</i></div></div></div><div class="gmail_msg"><i><br class="gmail_msg"></i></div></div><div class="gmail_msg" style="font-size:13px"><i>to partially specify the types of the result. I think this is a separate-but-interesting proposal (that is out of scope for Swift 4 stage 1).</i></div></div><div><br></div><div>Yes, yes, yes, yes and yes. Yes! A very rewarding outcome from the discussion! We should start a co-authored proposal asap.</div><div><br></div><div><span style="font-size:13px"><i>As I noted in my reply to Dave, I personally don’t want this: I feel that the idiom used by unsafeBitCast produces more readable code with already-existing features.</i></span><br></div><div><span style="font-size:13px"><br></span></div><div>In this aspect I disagree. The argument is the following:</div><div><br></div><div>One of the problems generic functions as a language feature aim to assist with (eradicate) is the questionable pattern of using formal arguments in ordinary functions for the <b>sole</b> purpose of passing type information. It is not only about duplicated code. And the problem with the pattern is that there is nothing that tells the compiler and other code analysing tools that the parameter has been used only for that purpose. Nor the human eye without using additional knowledge.Thus, when that pattern is used in a generic function, it is like having the antithesis of the feature while using the feature itself. And this is a reason why I believe the discussion goes beyond a syntactic convenience.</div><div><br></div><div>Emphasising on the proposed <span style="color:rgb(4,51,255);font-family:menlo;font-size:11px">explicit</span> keyword above, this would be a very convenient way to pass in formation to the compiler (and the user) that would be otherwise hosted by the author of the function (as it is the case of the <span style="font-family:menlo;font-size:11px">unsafeBitCast</span> example).</div><div><br></div><div>Best regards,</div><div>Ramiro</div><div><br><br><div class="gmail_quote"><div dir="ltr">On Thu, 1 Dec 2016 at 15:53 Douglas Gregor &lt;<a href="mailto:dgregor@apple.com">dgregor@apple.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 style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><blockquote type="cite" class="gmail_msg"><div class="gmail_msg">On Nov 30, 2016, at 4:05 PM, Ramiro Feria Purón &lt;<a href="mailto:ramiro.feria.puron@gmail.com" class="gmail_msg" target="_blank">ramiro.feria.puron@gmail.com</a>&gt; wrote:</div><br class="m_2778705408532542046Apple-interchange-newline gmail_msg"><div class="gmail_msg"><div dir="ltr" class="gmail_msg">Formally, perhaps the proposal should include the following:<div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">1. Missing type parameters are assumed to be implicit and trailing (as in the particular case of all type parameters missing).</div></div></div></blockquote><div class="gmail_msg"><br class="gmail_msg"></div></div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg">Yeah, this makes sense. Presumably this means that one could also write</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><span class="m_2778705408532542046Apple-tab-span gmail_msg" style="white-space:pre-wrap">        </span>foo&lt;&gt;(1)</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">where everything is still deduced. In C++, this syntax exists and means that non-template functions named “foo” are ignored.</div></div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><br class="gmail_msg"><blockquote type="cite" class="gmail_msg"><div class="gmail_msg"><div dir="ltr" class="gmail_msg"><div class="gmail_msg">2. _ is allowed as a placeholder when specifying explicit parameters in a function call. The corresponding parameter is assumed to be implicit.</div></div></div></blockquote><div class="gmail_msg"><br class="gmail_msg"></div></div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg">This could be a more general feature that works wherever a type is specified and deduction works. For example, today you can do, e.g,</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><span class="m_2778705408532542046Apple-tab-span gmail_msg" style="white-space:pre-wrap">        </span>let d1: Dictionary = [ “Hello” : 2017 ]</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">and we’ll infer the type arguments. It wouldn’t be unreasonable to allow </div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><div class="gmail_msg"><span class="m_2778705408532542046Apple-tab-span gmail_msg" style="white-space:pre-wrap">        </span>let d2: Dictionary&lt;_, Int32&gt; = [ “Hello”: 2017 ]</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">or</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><div class="gmail_msg"><span class="m_2778705408532542046Apple-tab-span gmail_msg" style="white-space:pre-wrap">        </span>let d3: [ _: Int32 ] = [ “Hello”: 2017 ]</div></div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">or </div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg"><span class="m_2778705408532542046Apple-tab-span gmail_msg" style="white-space:pre-wrap">        </span>let d4 = [ “Hello”: 2017 ] as [ _: Int32 ]</div></div></div><div class="gmail_msg"><br class="gmail_msg"></div></div><div class="gmail_msg">to partially specify the types of the result. I think this is a separate-but-interesting proposal (that is out of scope for Swift 4 stage 1).</div><div class="gmail_msg"><br class="gmail_msg"></div></div><div class="gmail_msg"></div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><blockquote type="cite" class="gmail_msg"><div class="gmail_msg"><div dir="ltr" class="gmail_msg"><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">In addition to this, and following the discussion on the <span style="font-family:menlo;font-size:11px" class="gmail_msg">unsafeBitCast </span>example, it might be a good idea to incorporate to the proposal adding an (optional) <span style="color:rgb(4,51,255);font-family:menlo;font-size:11px" class="gmail_msg">explicit</span> keyword for type parameters in generic function definitions:</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">func</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> unsafeBitCast&lt;<span style="color:rgb(4,51,255)" class="gmail_msg">explicit</span> U, T&gt;(</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">_</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> x: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">T</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">) -&gt; </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">U</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"></span><br class="gmail_msg"></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,143,0)" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">foo(unsafeBitCast(something))      </span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">// error: explicit type parameter required</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">foo(unsafeBitCast&lt;</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">U</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">&gt;(something))   </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,143,0)" class="gmail_msg">// ok</span></div></div></div></div></blockquote><div class="gmail_msg"><br class="gmail_msg"></div></div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg">As I noted in my reply to Dave, I personally don’t want this: I feel that the idiom used by unsafeBitCast produces more readable code with already-existing features.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><span class="m_2778705408532542046Apple-tab-span gmail_msg" style="white-space:pre-wrap">        </span>- Doug</div></div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg"><br class="gmail_msg"></div><br class="gmail_msg"><blockquote type="cite" class="gmail_msg"><div class="gmail_msg"><div dir="ltr" class="gmail_msg"><div class="gmail_msg"><div style="margin:0px;line-height:normal" class="gmail_msg">Regards,</div><div style="margin:0px;line-height:normal" class="gmail_msg">Ramiro<br class="gmail_msg"></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><br class="gmail_msg"></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><br class="gmail_msg"></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><br class="gmail_msg"></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><br class="gmail_msg"></div></div><div class="gmail_msg"><div class="gmail_quote gmail_msg"><div dir="ltr" class="gmail_msg">On Thu, 1 Dec 2016 at 01:36 Ramiro Feria Purón &lt;<a href="mailto:ramiro.feria.puron@gmail.com" class="gmail_msg" target="_blank">ramiro.feria.puron@gmail.com</a>&gt; wrote:<br class="gmail_msg"></div><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="gmail_msg">Or perhaps in a more &quot;swifty&quot; way, use _ for implicit type parameters, i.e.:<div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><span class="gmail_msg" style="color:rgb(52,149,175);font-family:menlo;font-size:11px;font-variant-ligatures:no-common-ligatures">f&lt;_,T&gt;</span><span class="gmail_msg" style="font-family:menlo;font-size:11px;font-variant-ligatures:no-common-ligatures">(</span><span class="gmail_msg" style="font-family:menlo;font-size:11px;font-variant-ligatures:no-common-ligatures">)</span><br class="gmail_msg"></div></div><br class="gmail_msg"><div class="gmail_quote gmail_msg"><div dir="ltr" class="gmail_msg">On Thu, 1 Dec 2016 at 01:13 Ramiro Feria Purón &lt;<a href="mailto:ramiro.feria.puron@gmail.com" class="gmail_msg" target="_blank">ramiro.feria.puron@gmail.com</a>&gt; wrote:<br class="gmail_msg"></div><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="gmail_msg">Douglas,<div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Regarding the question on the restriction for type parameters to appear on the signature, the answer is remain. The proposal does not intend this restriction to be lifted.</div><div class="gmail_msg"><br class="gmail_msg" style="font-size:13px;white-space:pre-wrap"><span style="font-size:13px;white-space:pre-wrap" class="gmail_msg">One might expect to find a few legitimate cases where having it lifted would be handy or desirable. They seem to emerge often, for example, while developing components using Core Data. From a real case scenario:</span></div><div class="gmail_msg"><span style="font-size:13px;white-space:pre-wrap" class="gmail_msg"><br class="gmail_msg"></span></div><div class="gmail_msg"><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">protocol</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> Activable { </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">var</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> dateLastActive: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">Date</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> { </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">get</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> } </span>}</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"></span><br class="gmail_msg"></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(52,149,175)" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">class</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> A: </span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">NSManagedObject</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> {}</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(52,149,175)" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">class</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> B: </span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">NSManagedObject</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> {}</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,143,0)" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">//..</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(52,149,175)" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">class</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> Z: </span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">NSManagedObject</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> {}</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"></span><br class="gmail_msg"></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">extension</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">A</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">Activable</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> { </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">var</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> dateLastActive: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">Date</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> { </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">return</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">Date</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">() } }</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">extension</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">B</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">Activable</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> { </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">var</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> dateLastActive: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">Date</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> { </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">return</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">Date</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">() } }</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,143,0)" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">//..</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">extension</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">Z</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">Activable</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> { </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">var</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> dateLastActive: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">Date</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> { </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">return</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">Date</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">() } }</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"></span><br class="gmail_msg"></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"></span><br class="gmail_msg"></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"></span><br class="gmail_msg"></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">func</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> deleteInactiveObjects&lt;T: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">NSManagedObject</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">&gt;(since date: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">Date</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">, inContext context: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">NSManagedObjectContext</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">) </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">where</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">T</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">Activable</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> {</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,143,0)" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">    </span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">//..</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">}</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"></span><br class="gmail_msg"></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,143,0)" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">// for the sake of the example</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(52,149,175)" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">let</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> context = </span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">NSManagedObjectContext</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">(concurrencyType: .</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">privateQueueConcurrencyType</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">)</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">let</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> yesterday = </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">Date</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">()</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">let</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> oneWeekAgo = </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">Date</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">()</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"></span><br class="gmail_msg"></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"></span><br class="gmail_msg"></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(52,149,175)" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">deleteInactiveObjects&lt;A&gt;</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">(since: </span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">yesterday</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">, inContext: </span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">context</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">)</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(52,149,175)" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">deleteInactiveObjects&lt;B&gt;</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">(since: </span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">oneWeekAgo</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">, inContext: </span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">context</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">)</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,143,0)" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">//..</span></div></div><div class="gmail_msg"><span style="font-size:13px;white-space:pre-wrap" class="gmail_msg"><br class="gmail_msg"></span></div><div class="gmail_msg"><span style="font-size:13px;white-space:pre-wrap" class="gmail_msg">(here again, as you mention, the parameter affects how the function operates, yet it is not part of the signature)</span></div><div class="gmail_msg"><span style="font-size:13px;white-space:pre-wrap" class="gmail_msg"><br class="gmail_msg"></span></div><div class="gmail_msg"><span style="font-size:13px;white-space:pre-wrap" class="gmail_msg">If the restriction was lifted, however, it </span><span style="font-size:13px;white-space:pre-wrap" class="gmail_msg">would also be in detriment of the educational value of the proposal (</span><span style="font-size:13px;white-space:pre-wrap" class="gmail_msg">apart from your arguments above)</span><span style="font-size:13px;white-space:pre-wrap" class="gmail_msg">. </span><span style="font-size:13px;white-space:pre-wrap" class="gmail_msg">When defining a generic function, it feels natural to expect all of the type parameters to be present in the generic function signature. Relaxing this rule could be perceived by the novice as an invitation to an obscure design. In the best case, it would generate doubts about its actual intent. </span></div><div class="gmail_msg"><br class="gmail_msg" style="font-size:13px;white-space:pre-wrap"><span style="font-size:13px;white-space:pre-wrap" class="gmail_msg">From a pedagogical perspective, the proposal aims to save Swift from disappointment when this topic is brought to discussion, say whether at the end of a Programming or a Compilers undergraduate course -- albeit fully understanding (or implementing) the current alternatives could be an excellent exercise for the class.</span></div><div class="gmail_msg"><span style="font-size:13px;white-space:pre-wrap" class="gmail_msg"><br class="gmail_msg"></span></div><div class="gmail_msg"><span style="font-size:13px;white-space:pre-wrap" class="gmail_msg">From the (primary) language and development perspective, I don&#39;t think it could be expressed in a better way than in your lines, which are truly appreciated:</span></div></div><div dir="ltr" class="gmail_msg"><div class="gmail_msg"><span style="font-size:13px;white-space:pre-wrap" class="gmail_msg"><br class="gmail_msg"></span></div><div class="gmail_msg"><span style="font-size:13px" class="gmail_msg">&quot;<i class="gmail_msg">That’s how I see this proposal: not as a replacement for the metatype parameter idiom that unsafeBitCast uses, but as a way to be more explicit at particular call sites when type inference either fails (e.g., due to lack of contextual type information), produces a result different than what is desired, or is sufficiently complicated that the call site requires more documentation.</i><span style="white-space:pre-wrap" class="gmail_msg">&quot;</span></span></div><div class="gmail_msg"><span style="font-size:13px;white-space:pre-wrap" class="gmail_msg"><br class="gmail_msg"></span></div></div><div dir="ltr" class="gmail_msg"><div class="gmail_msg"><span style="white-space:pre-wrap" class="gmail_msg">Finally, we should also consider the possibility of being explicit about some but not all type parameters. If allowed, something like &quot;only trailing type parameters could be missing&quot; would be necessary to avoid ambiguity.</span></div><div class="gmail_msg"><span style="white-space:pre-wrap" class="gmail_msg"><br class="gmail_msg"></span></div><div class="gmail_msg"><span style="white-space:pre-wrap" class="gmail_msg">All the best,</span></div><div class="gmail_msg"><span style="white-space:pre-wrap" class="gmail_msg">Ramiro</span></div></div><div dir="ltr" class="gmail_msg"><div class="gmail_msg"><span style="white-space:pre-wrap" class="gmail_msg"><br class="gmail_msg"></span></div><div class="gmail_msg"><br class="gmail_msg"><div class="gmail_quote gmail_msg"><div dir="ltr" class="gmail_msg">On Tue, 29 Nov 2016 at 17:11 Douglas Gregor &lt;<a href="mailto:dgregor@apple.com" class="gmail_msg" target="_blank">dgregor@apple.com</a>&gt; wrote:<br class="gmail_msg"></div><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="gmail_msg"><br class="gmail_msg"><div class="gmail_msg"><blockquote type="cite" class="gmail_msg"><div class="gmail_msg">On Nov 21, 2016, at 3:05 PM, Ramiro Feria Purón via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div><br class="gmail_msg m_2778705408532542046m_-7637062993085499428m_2793299352371213050m_6032648967616326866Apple-interchange-newline"><div class="gmail_msg"><div dir="ltr" class="gmail_msg"><b class="gmail_msg">Problem:</b><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Currently, it is not possible to be explicit about the generic parameters (type parameters) in a generic function call. Type parameters are inferred from actual parameters:</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">func</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> f&lt;T&gt;(</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">_</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> t: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">T</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">) {</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">    </span><br class="m_2778705408532542046m_-7637062993085499428m_2793299352371213050m_6032648967616326866webkit-block-placeholder gmail_msg"></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,143,0)" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">    </span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">//..</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">}</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"><br class="gmail_msg"></span></div></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,143,0)" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">f</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">(5)            </span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">// T inferred to be Int</span></div>
<div class="gmail_msg"><span style="font-family:menlo;font-size:11px;font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">f</span><span style="font-family:menlo;font-size:11px;font-variant-ligatures:no-common-ligatures" class="gmail_msg">(</span><span style="font-family:menlo;font-size:11px;font-variant-ligatures:no-common-ligatures;color:rgb(180,38,26)" class="gmail_msg">&quot;xzcvzxcvx&quot;</span><span style="font-family:menlo;font-size:11px;font-variant-ligatures:no-common-ligatures" class="gmail_msg">)  </span><span style="color:rgb(0,143,0);font-family:menlo;font-size:11px;font-variant-ligatures:no-common-ligatures" class="gmail_msg">// T inferred to be string</span> </div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">If no type parameter is involved in the formal parameters, the type parameter needs to be used somehow as part of the return type. For example:</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">func</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> g&lt;T&gt;(</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">_</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> x: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">Int</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">) -&gt; [</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">T</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">] {</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">    </span><br class="m_2778705408532542046m_-7637062993085499428m_2793299352371213050m_6032648967616326866webkit-block-placeholder gmail_msg"></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">    </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">var</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> result: [</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">T</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">] = []</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">    </span><br class="m_2778705408532542046m_-7637062993085499428m_2793299352371213050m_6032648967616326866webkit-block-placeholder gmail_msg"></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,143,0)" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">    </span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">//..</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">    </span><br class="m_2778705408532542046m_-7637062993085499428m_2793299352371213050m_6032648967616326866webkit-block-placeholder gmail_msg"></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">    </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">return</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> result</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">}</span></div></div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">In such cases, the type parameters must be inferrable from the context:<br class="gmail_msg"></div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">g</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">(7)                            </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,143,0)" class="gmail_msg">// Error: T cannot be inferred</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,143,0)" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">let</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> array = </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">g</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">(7)                </span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">// Error: T cannot be inferred</span></div><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,143,0)" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"></span></p><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">let</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> array: [</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">String</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">] = </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">g</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">(7)      </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,143,0)" class="gmail_msg">// Ok: T inferred to be String</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,143,0)" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">let</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> array = </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">g</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">&lt;</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">String</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">&gt;(7)        </span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">// Error: Cannot explicitly specialise generic function</span><br class="gmail_msg"></span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,143,0)" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"><br class="gmail_msg"></span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,143,0)" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"><br class="gmail_msg"></span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,143,0)" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"><br class="gmail_msg"></span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,143,0)" class="gmail_msg"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small" class="gmail_msg"><b class="gmail_msg">Proposed Solution:</b></span></div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Allow explicit type parameters in generic function call:</div></div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">let</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">_</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> = </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">g</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">&lt;</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">String</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">&gt;(7)            </span><span style="color:rgb(0,143,0)" class="gmail_msg">// Ok</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"><br class="gmail_msg"></span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"><br class="gmail_msg"></span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"><br class="gmail_msg"></span></div><div style="margin:0px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"><b style="color:rgb(34,34,34);font-family:arial,sans-serif" class="gmail_msg">Motivation<span style="font-size:11px" class="gmail_msg">:</span></b></span></div><div class="gmail_msg"><br class="gmail_msg"></div><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"></span></p><div class="gmail_msg">Consider the following contrived example:</div></div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">class</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> Vehicle {</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">    </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">var</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> currentSpeed = 0</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,143,0)" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">    </span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">//..</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">}</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"></span><br class="gmail_msg"></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">class</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> Bicycle: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">Vehicle</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> {</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,143,0)" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">    </span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">//..</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">}</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"></span><br class="gmail_msg"></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">class</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> Car: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">Vehicle</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> {</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,143,0)" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">    </span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">//..</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">}</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"><br class="gmail_msg"></span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(4,51,255)" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">@discardableResult</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">func</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> processAll&lt;T: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">Vehicle</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">&gt;(in vehicles: [</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">Vehicle</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">], condition: (</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">Vehicle</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">) -&gt; </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">Bool</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">) -&gt; [</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">T</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">] {</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">    </span><br class="m_2778705408532542046m_-7637062993085499428m_2793299352371213050m_6032648967616326866webkit-block-placeholder gmail_msg"></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">    </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">var</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> processed: [</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">T</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">] = []</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">    </span><br class="m_2778705408532542046m_-7637062993085499428m_2793299352371213050m_6032648967616326866webkit-block-placeholder gmail_msg"></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">    </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">for</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> vehicle </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">in</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> vehicles {</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">        </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">guard</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">let</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> t = vehicle </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">as</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">? </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">T</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">, condition(vehicle) </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">else</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> { </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">continue</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> }</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">        </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,143,0)" class="gmail_msg">//..</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">        processed.</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">append</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">(t)</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">    }</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">    </span><br class="m_2778705408532542046m_-7637062993085499428m_2793299352371213050m_6032648967616326866webkit-block-placeholder gmail_msg"></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">    </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">return</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> processed</span></div><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(4,51,255)" class="gmail_msg">











</p><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">}</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"><br class="gmail_msg"></span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">func</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> aboveSpeedLimit(vehicle: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">Vehicle</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">) -&gt; </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">Bool</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> {</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">    </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">return</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> vehicle.</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">currentSpeed</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> &gt;= 100</span></div><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">

</span></p><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">}</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"><br class="gmail_msg"></span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"><br class="gmail_msg"></span></div><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"></span></p><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">let</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> processedVehicles = </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">processAll</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">(in: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">vehicles</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">, condition: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">aboveSpeedLimit</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">)        </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,143,0)" class="gmail_msg">// Uh, T inferred to be Vehicle!</span></div><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,143,0)" class="gmail_msg"></span></p><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="gmail_msg">let</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"> processedCars: [</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">Car</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">] = </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">processAll</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">(in: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">vehicles</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">, condition: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">aboveSpeedLimit</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">)     </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,143,0)" class="gmail_msg">// T inferred to be Car</span></div><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,143,0)" class="gmail_msg"></span></p><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(0,143,0)" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">processAll</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">&lt;</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">Bicycle</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">&gt;(in: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">vehicles</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">, condition: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="gmail_msg">aboveSpeedLimit</span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">)                       </span><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg">// This should be allowed under this proposal</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"><br class="gmail_msg"></span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"><br class="gmail_msg"></span></div><div style="margin:0px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"><b style="color:rgb(34,34,34);font-family:arial,sans-serif" class="gmail_msg">Notes<span style="font-size:11px" class="gmail_msg">:</span></b></span></div><div class="gmail_msg"><br class="gmail_msg"></div><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"></span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo" class="gmail_msg"><span style="font-variant-ligatures:no-common-ligatures" class="gmail_msg"></span></p><div class="gmail_msg">If necessary, the (real life) Swift code that lead to the proposal could be shared.</div></div></div></div></blockquote><br class="gmail_msg"></div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg">This seems completely reasonable to me. I had always expected us to implement this feature, but we never got around to it, and it wasn’t a high priority because one can always use type inference. Additionally, there were a few places where we originally thought we wanted this feature, but prefer the more-explicit form where the user is required to explicitly pass along a metatype. unsafeBitCast is one such case:</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><span class="m_2778705408532542046m_-7637062993085499428m_2793299352371213050m_6032648967616326866Apple-tab-span gmail_msg" style="white-space:pre-wrap">        </span>func unsafeBitCast&lt;T, U&gt;(_ x: T, to: U.Type) -&gt; U</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Even if we had the ability to provide explicit type arguments, we would *not* want to change this signature to</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><div class="gmail_msg"><span class="m_2778705408532542046m_-7637062993085499428m_2793299352371213050m_6032648967616326866Apple-tab-span gmail_msg" style="white-space:pre-wrap">        </span>func unsafeBitCast&lt;U, T&gt;(_ x: T) -&gt; U     // bad idea</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">because while it makes the correct usage slightly cleaner:</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><span class="m_2778705408532542046m_-7637062993085499428m_2793299352371213050m_6032648967616326866Apple-tab-span gmail_msg" style="white-space:pre-wrap">        </span>unsafeBitCast&lt;Int&gt;(something)<span class="m_2778705408532542046m_-7637062993085499428m_2793299352371213050m_6032648967616326866Apple-tab-span gmail_msg" style="white-space:pre-wrap">        </span>// slightly prettier, but...</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">it would enable type inference to go wild with unsafe casts:</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><span class="m_2778705408532542046m_-7637062993085499428m_2793299352371213050m_6032648967616326866Apple-tab-span gmail_msg" style="white-space:pre-wrap">        </span>foo(unsafeBitCast(something))<span class="m_2778705408532542046m_-7637062993085499428m_2793299352371213050m_6032648967616326866Apple-tab-span gmail_msg" style="white-space:pre-wrap">        </span>// just cast it to.. whatever<span class="m_2778705408532542046m_-7637062993085499428m_2793299352371213050m_6032648967616326866Apple-tab-span gmail_msg" style="white-space:pre-wrap">        </span></div></div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">which is… not great.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">I’d like one bit of clarification in the proposal. Right now, one is not permitted to have a type parameter in a generic function that isn’t used somewhere in its signature, e.g.,</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><span class="m_2778705408532542046m_-7637062993085499428m_2793299352371213050m_6032648967616326866Apple-tab-span gmail_msg" style="white-space:pre-wrap">        </span>func f&lt;T&gt;() -&gt; Void { … }   // error: T is not part of the signature of f()</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">This restriction is obvious in today’s Swift, because there is absolutely no way one could ever use this function. With your proposed extension, it would be possible to use this function. Does the restriction remain or is it lifted?</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Personally, I’d like the restriction to stay, because it feels like such functions fall into the same camp as unsafeBitCast: if the type parameter affects how the function operates but is *not* part of its signature, then it should be expressed like a normal parameter (of a metatype). It also helps provide better diagnostics when changing a generic function to no longer require one of its type parameters.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">And, as Dave notes, it’s effectively syntactic sugar, so it belongs in Swift 4 stage 2.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><span class="m_2778705408532542046m_-7637062993085499428m_2793299352371213050m_6032648967616326866Apple-tab-span gmail_msg" style="white-space:pre-wrap">        </span>- Doug</div><div class="gmail_msg"><br class="gmail_msg"></div><br class="gmail_msg"></div></blockquote></div></div></div></blockquote></div></blockquote></div></div></div>
</div></blockquote></div></div></blockquote></div></div></div>