<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=""><div class="">If you want to feed it a type rather than infer it from variable type or cast it using as! Then you can just add the type as a parameter…</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">func</span><span style="font-variant-ligatures: no-common-ligatures" class=""> processAll&lt;T: </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">Vehicle</span><span style="font-variant-ligatures: no-common-ligatures" class="">&gt;(type: </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">T</span><span style="font-variant-ligatures: no-common-ligatures" class="">.Type, in vehicles: [</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">Vehicle</span><span style="font-variant-ligatures: no-common-ligatures" class="">], condition: (</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">Vehicle</span><span style="font-variant-ligatures: no-common-ligatures" class="">) -&gt; </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Bool</span><span style="font-variant-ligatures: no-common-ligatures" class="">) -&gt; [</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">T</span><span style="font-variant-ligatures: no-common-ligatures" class="">] {</span></div><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(186, 45, 162);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="font-variant-ligatures: no-common-ligatures" class="">return</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> []</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">processAll</span><span style="font-variant-ligatures: no-common-ligatures" class="">(type: </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">Bicycle</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">self</span><span style="font-variant-ligatures: no-common-ligatures" class="">, in: [</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">Vehicle</span><span style="font-variant-ligatures: no-common-ligatures" class="">()], condition: {</span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">_</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">in</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">true</span><span style="font-variant-ligatures: no-common-ligatures" class="">})&nbsp;</span></div></div><br class=""><div><blockquote type="cite" class=""><div class="">On Nov 21, 2016, at 8:24 PM, Ramiro Feria Purón via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Yes, it does; as it does&nbsp;<span style="font-family:menlo;font-size:11px;font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="">let</span><span style="font-family: menlo; font-size: 11px; font-variant-ligatures: no-common-ligatures;" class="">&nbsp;processedCars: [</span><span style="font-family:menlo;font-size:11px;font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">Car</span><span style="font-family: menlo; font-size: 11px; font-variant-ligatures: no-common-ligatures;" class="">] =&nbsp;</span><span style="font-family:menlo;font-size:11px;font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">processAll</span><span style="font-family: menlo; font-size: 11px; font-variant-ligatures: no-common-ligatures;" class="">(in:&nbsp;</span><span style="font-family:menlo;font-size:11px;font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">vehicles</span><span style="font-family: menlo; font-size: 11px; font-variant-ligatures: no-common-ligatures;" class="">, condition:&nbsp;</span><span style="font-family:menlo;font-size:11px;font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">aboveSpeedLimit</span><span style="font-family: menlo; font-size: 11px; font-variant-ligatures: no-common-ligatures;" class="">)</span><div class=""><span style="font-family: menlo; font-size: 11px; font-variant-ligatures: no-common-ligatures;" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures:no-common-ligatures" class=""><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.800000190734863px" class="">The core of the matter is that it is nowhere stated in the call (expression)&nbsp;</span><span style="color:rgb(52,149,175);font-family:menlo;font-size:11px;font-variant-ligatures:no-common-ligatures" class="">processAll</span><span style="font-family: menlo; font-size: 11px; font-variant-ligatures: no-common-ligatures;" class="">(in:&nbsp;</span><span style="color:rgb(52,149,175);font-family:menlo;font-size:11px;font-variant-ligatures:no-common-ligatures" class="">vehicles</span><span style="font-family: menlo; font-size: 11px; font-variant-ligatures: no-common-ligatures;" class="">, condition:&nbsp;</span><span style="color:rgb(52,149,175);font-family:menlo;font-size:11px;font-variant-ligatures:no-common-ligatures" class="">aboveSpeedLimit</span><span style="font-family: menlo; font-size: 11px; font-variant-ligatures: no-common-ligatures;" class="">)&nbsp;</span><span style="font-size:12.800000190734863px" class="">that the&nbsp;specialised version&nbsp;</span><span style="font-family:menlo;font-size:11px;font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">processAll</span><span style="font-family: menlo; font-size: 11px; font-variant-ligatures: no-common-ligatures;" class="">&lt;</span><span style="font-family:menlo;font-size:11px;font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">Bicycle</span><span style="font-family: menlo; font-size: 11px; font-variant-ligatures: no-common-ligatures;" class="">&gt; </span><span style="font-size:12.800000190734863px" class="">is the one to be called.&nbsp;</span></span></div><div class=""><span style="font-variant-ligatures:no-common-ligatures" class=""><span style="font-size:12.800000190734863px" class=""><br class=""></span></span></div><div class=""><span style="font-variant-ligatures:no-common-ligatures" class=""><span style="font-size:12.800000190734863px" class="">Although we are aware of the&nbsp;semantics, it does not read naturally and is somehow confusing. The ultimate goal is to make swift cleaner and clear. It rather feels like invoking non-specialised, non-generic function, and then casting the result to an array of a given type, which is not the case.</span><br class=""></span></div><div class=""><span style="font-variant-ligatures:no-common-ligatures" class=""><span style="font-size:12.800000190734863px" class=""><br class=""></span></span></div><div class=""><span style="font-variant-ligatures:no-common-ligatures" class=""><span style="font-size:12.800000190734863px" class="">All&nbsp;the&nbsp;best,</span></span></div><div class=""><span style="font-variant-ligatures:no-common-ligatures" class=""><span style="font-size:12.800000190734863px" class="">Ramiro</span></span></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">2016-11-22 12:09 GMT+11:00 Sean Heber <span dir="ltr" class="">&lt;<a href="mailto:sean@fifthace.com" target="_blank" class="">sean@fifthace.com</a>&gt;</span>:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto" class=""><div class="">Doesn't this work?</div><div class=""><br class=""></div><div class="">processAll(in: vehicles, condition: aboveSpeedLimit) as [Bicycle]</div><div class=""><br class=""></div><div class="">l8r</div><div class="">Sean</div><div class=""><br class=""><div class="">Sent from my iPad</div></div><div class=""><div class="h5"><div class=""><br class="">On Nov 21, 2016, at 6:11 PM, Ramiro Feria Purón via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><span style="font-size:12.800000190734863px" class="">Inferring the type of an expression from its surrounding context is not necessarily an ideal feature in a strongly typed programming language.</span><div style="font-size:12.800000190734863px" class=""><br class=""></div><div style="font-size:12.800000190734863px" class="">The goal here is to be able to be explicit about the type, in an elegant and clear way, especially when there is no (need for a) context.&nbsp;</div><div style="font-size:12.800000190734863px" class=""><br class=""></div><div style="font-size:12.800000190734863px" class="">Note that the &lt;Type&gt; "noise" would only be necessary when the type could not be inferred from the actual parameters (and if the current surrounding context&nbsp;type inference was removed, which is not part of the proposal).</div><div style="font-size:12.800000190734863px" class=""><br class=""></div><div style="font-size:12.800000190734863px" class="">The line of code from the Motivation that does not compile is:</div><div style="font-size:12.800000190734863px" class=""><br class=""></div><div style="font-size:12.800000190734863px" class=""><span style="font-family:menlo;font-size:11px;font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">processAll</span><span style="font-family: menlo; font-size: 11px; font-variant-ligatures: no-common-ligatures;" class="">&lt;</span><span style="font-family:menlo;font-size:11px;font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">Bicycle</span><span style="font-family: menlo; font-size: 11px; font-variant-ligatures: no-common-ligatures;" class="">&gt;(in:&nbsp;</span><span style="font-family:menlo;font-size:11px;font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">vehicl<wbr class="">es</span><span style="font-family: menlo; font-size: 11px; font-variant-ligatures: no-common-ligatures;" class="">, condition:&nbsp;</span><span style="font-family:menlo;font-size:11px;font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">aboveSpeedLimit</span><span style="font-family: menlo; font-size: 11px; font-variant-ligatures: no-common-ligatures;" class="">) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color:rgb(0,143,0);font-family:menlo;font-size:11px;font-variant-ligatures:no-common-ligatures" class="">// This should be allowed under this proposal</span><br class=""></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">2016-11-22 10:35 GMT+11:00 Adrian Zubarev <span dir="ltr" class="">&lt;<a href="mailto:adrian.zubarev@devandartist.com" target="_blank" class="">adrian.zubarev@devandartist.<wbr class="">com</a>&gt;</span>:<br class=""><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=""><div class="m_1528253077411346657m_-7327322934150946090bloop_markdown"><p class="">I’m not sure what are you trying to solve here. Your code from the motivation compiles just fine in my Playground.</p><p class="">About the <code class="">g</code> function:</p>

<pre class=""><code class="m_1528253077411346657m_-7327322934150946090swift">g(7) as [String]  
let _: [String] = g(7)
</code></pre><p class="">Personally I don’t like to see <code class="">&lt;Type&gt;</code> noise on functions in Swift.</p><div class=""><br class="webkit-block-placeholder"></div></div><div class="m_1528253077411346657m_-7327322934150946090bloop_original_html"><div id="m_1528253077411346657m_-7327322934150946090bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; margin: 0px;" class=""><br class=""></div> <br class=""> <div id="m_1528253077411346657m_-7327322934150946090bloop_sign_1479771201736640000" class="m_1528253077411346657m_-7327322934150946090bloop_sign"><div style="font-family:helvetica,arial;font-size:13px" class="">--&nbsp;<br class="">Adrian Zubarev<br class="">Sent with Airmail</div></div><div class=""><div class="m_1528253077411346657h5"> <br class=""><p class="m_1528253077411346657m_-7327322934150946090airmail_on">Am 22. November 2016 um 00:06:02, Ramiro Feria Purón via swift-evolution (<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>) schrieb:</p> </div></div><blockquote type="cite" class="m_1528253077411346657m_-7327322934150946090clean_bq"><span class=""><div class=""><div class=""></div><div class=""><div class=""><div class="m_1528253077411346657h5">





<div dir="ltr" class=""><b class="">Problem:</b>
<div class=""><br class=""></div>
<div class="">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=""><br class=""></div>
<div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="">func</span>
<span style="font-variant-ligatures:no-common-ligatures" class="">f&lt;T&gt;(</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="">_</span>
<span style="font-variant-ligatures:no-common-ligatures" class="">t:</span>
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">T</span><span style="font-variant-ligatures:no-common-ligatures" class="">)
{</span></div><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; min-height: 13px;" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">&nbsp;&nbsp;
&nbsp;</span><br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(0, 143, 0);" class="">
<span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;
&nbsp;</span> <span style="font-variant-ligatures:no-common-ligatures" class="">//..</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""><br class=""></span></div>
</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(0, 143, 0);" class="">
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">f</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(5)&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span> <span style="font-variant-ligatures:no-common-ligatures" class="">// T inferred to be
Int</span></div>
<div class=""><span style="font-family:menlo;font-size:11px;font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">
f</span><span style="font-family: menlo; font-size: 11px; font-variant-ligatures: no-common-ligatures;" class="">(</span><span style="font-family:menlo;font-size:11px;font-variant-ligatures:no-common-ligatures;color:rgb(180,38,26)" class="">"xzcvzxcvx"</span><span style="font-family: menlo; font-size: 11px; font-variant-ligatures: no-common-ligatures;" class="">)&nbsp;</span>
<span style="color:rgb(0,143,0);font-family:menlo;font-size:11px;font-variant-ligatures:no-common-ligatures" class="">
// T inferred to be string</span>&nbsp;</div>
<div class=""><br class=""></div>
<div class="">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=""><br class=""></div>
<div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="">func</span>
<span style="font-variant-ligatures:no-common-ligatures" class="">g&lt;T&gt;(</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="">_</span>
<span style="font-variant-ligatures:no-common-ligatures" class="">x:</span>
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">Int</span><span style="font-variant-ligatures:no-common-ligatures" class="">)
-&gt; [</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">T</span><span style="font-variant-ligatures:no-common-ligatures" class="">]
{</span></div><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; min-height: 13px;" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">&nbsp;&nbsp;
&nbsp;</span><br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">&nbsp;
&nbsp;</span> <span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="">var</span>
<span style="font-variant-ligatures:no-common-ligatures" class="">result:
[</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">T</span><span style="font-variant-ligatures:no-common-ligatures" class="">]
= []</span></div><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; min-height: 13px;" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">&nbsp;&nbsp;
&nbsp;</span><br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(0, 143, 0);" class="">
<span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;
&nbsp;</span> <span style="font-variant-ligatures:no-common-ligatures" class="">//..</span></div><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; min-height: 13px;" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">&nbsp;&nbsp;
&nbsp;</span><br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">&nbsp;
&nbsp;</span> <span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="">return</span>
<span style="font-variant-ligatures:no-common-ligatures" class="">result</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">}</span></div>
</div>
<div class=""><br class=""></div>
<div class="">In such cases, the type parameters must be inferrable from the
context:<br class=""></div>
<div class=""><br class=""></div>
<div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">g</span><span style="font-variant-ligatures:no-common-ligatures" class="">(7)&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp;</span> <span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,143,0)" class="">//
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="">
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="">let</span>
<span style="font-variant-ligatures: no-common-ligatures;" class="">array
=</span> <span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">g</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(7)&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span>
<span style="font-variant-ligatures:no-common-ligatures" class="">// 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="">
</p><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="">let</span>
<span style="font-variant-ligatures:no-common-ligatures" class="">array:
[</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">String</span><span style="font-variant-ligatures:no-common-ligatures" class="">]
=</span> <span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">g</span><span style="font-variant-ligatures:no-common-ligatures" class="">(7)&nbsp;
&nbsp; &nbsp;</span> <span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,143,0)" class="">//
Ok: T&nbsp;inferred to be&nbsp;String</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,143,0)" class=""><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="">
let</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;array
=&nbsp;</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">g</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&lt;</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">String</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&gt;(7)&nbsp;
&nbsp; &nbsp; &nbsp;&nbsp;</span><span style="font-variant-ligatures:no-common-ligatures" class="">// Error: Cannot
explicitly specialise generic function</span><br class=""></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(0, 143, 0);" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""><br class=""></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(0, 143, 0);" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""><br class=""></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(0, 143, 0);" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""><br class=""></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(0, 143, 0);" class="">
<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small" class=""><b class="">
Proposed Solution:</b></span></div>
<div class=""><br class=""></div>
<div class="">Allow explicit type parameters in generic function call:</div>
</div>
<div class=""><br class=""></div>
<div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="">let</span>
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="">_</span>
<span style="font-variant-ligatures:no-common-ligatures" class="">=</span>
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">g</span><span style="font-variant-ligatures:no-common-ligatures" class="">&lt;</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">String</span><span style="font-variant-ligatures:no-common-ligatures" class="">&gt;(7)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color:rgb(0,143,0)" class="">// Ok</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""><br class=""></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""><br class=""></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""><br class=""></span></div><div style="margin: 0px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""><b style="color:rgb(34,34,34);font-family:arial,sans-serif" class="">Motivation<span style="font-size:11px" class="">:</span></b></span></div>
<div class=""><br class=""></div><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
</p>
<div class="">Consider the following contrived example:</div>
</div>
<div class=""><br class=""></div>
<div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="">class</span>
<span style="font-variant-ligatures:no-common-ligatures" class="">Vehicle
{</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">&nbsp;
&nbsp;</span> <span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="">var</span>
<span style="font-variant-ligatures:no-common-ligatures" class="">currentSpeed =
0</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(0, 143, 0);" class="">
<span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;
&nbsp;</span> <span style="font-variant-ligatures:no-common-ligatures" class="">//..</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; min-height: 13px;" class="">
<br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="">class</span>
<span style="font-variant-ligatures:no-common-ligatures" class="">Bicycle:</span>
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">Vehicle</span>
<span style="font-variant-ligatures:no-common-ligatures" class="">{</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(0, 143, 0);" class="">
<span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;
&nbsp;</span> <span style="font-variant-ligatures:no-common-ligatures" class="">//..</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; min-height: 13px;" class="">
<br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="">class</span>
<span style="font-variant-ligatures:no-common-ligatures" class="">Car:</span>
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">Vehicle</span>
<span style="font-variant-ligatures:no-common-ligatures" class="">{</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(0, 143, 0);" class="">
<span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;
&nbsp;</span> <span style="font-variant-ligatures:no-common-ligatures" class="">//..</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""><br class=""></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(4, 51, 255);" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">@discardableResult</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="">func</span>
<span style="font-variant-ligatures:no-common-ligatures" class="">processAll&lt;T:</span>
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">Vehicle</span><span style="font-variant-ligatures:no-common-ligatures" class="">&gt;(in
vehicles: [</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">Vehicle</span><span style="font-variant-ligatures:no-common-ligatures" class="">],
condition: (</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">Vehicle</span><span style="font-variant-ligatures:no-common-ligatures" class="">)
-&gt;</span> <span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">Bool</span><span style="font-variant-ligatures:no-common-ligatures" class="">)
-&gt; [</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">T</span><span style="font-variant-ligatures:no-common-ligatures" class="">]
{</span></div><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; min-height: 13px;" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">&nbsp;&nbsp;
&nbsp;</span><br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">&nbsp;
&nbsp;</span> <span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="">var</span>
<span style="font-variant-ligatures:no-common-ligatures" class="">processed:
[</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">T</span><span style="font-variant-ligatures:no-common-ligatures" class="">]
= []</span></div><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; min-height: 13px;" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">&nbsp;&nbsp;
&nbsp;</span><br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">&nbsp;
&nbsp;</span> <span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="">for</span>
<span style="font-variant-ligatures:no-common-ligatures" class="">vehicle</span>
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="">in</span>
<span style="font-variant-ligatures:no-common-ligatures" class="">vehicles
{</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">&nbsp;
&nbsp; &nbsp; &nbsp;</span> <span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="">guard</span>
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="">let</span>
<span style="font-variant-ligatures:no-common-ligatures" class="">t =
vehicle</span> <span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="">as</span><span style="font-variant-ligatures:no-common-ligatures" class="">?</span>
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">T</span><span style="font-variant-ligatures:no-common-ligatures" class="">,
condition(vehicle)</span> <span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="">else</span>
<span style="font-variant-ligatures:no-common-ligatures" class="">{</span>
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="">continue</span>
<span style="font-variant-ligatures:no-common-ligatures" class="">}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">&nbsp;
&nbsp; &nbsp; &nbsp;</span> <span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,143,0)" class="">//..</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">&nbsp;
&nbsp; &nbsp; &nbsp; processed.</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">append</span><span style="font-variant-ligatures:no-common-ligatures" class="">(t)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">&nbsp;
&nbsp; }</span></div><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; min-height: 13px;" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">&nbsp;&nbsp;
&nbsp;</span><br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">&nbsp;
&nbsp;</span> <span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="">return</span>
<span style="font-variant-ligatures:no-common-ligatures" class="">processed</span></div><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(4,51,255)" class="">
</p><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""><br class=""></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="">func</span>
<span style="font-variant-ligatures:no-common-ligatures" class="">aboveSpeedLimit(vehicle:</span>
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">Vehicle</span><span style="font-variant-ligatures:no-common-ligatures" class="">)
-&gt;</span> <span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">Bool</span>
<span style="font-variant-ligatures:no-common-ligatures" class="">{</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">&nbsp;
&nbsp;</span> <span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="">return</span>
<span style="font-variant-ligatures:no-common-ligatures" class="">vehicle.</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">currentSpeed</span><span style="font-variant-ligatures:no-common-ligatures" class="">&nbsp;&gt;=
100</span></div><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
</p><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""><br class=""></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""><br class=""></span></div><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
</p><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="">let</span>
<span style="font-variant-ligatures:no-common-ligatures" class="">processedVehicles
=</span> <span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">processAll</span><span style="font-variant-ligatures:no-common-ligatures" class="">(in:</span>
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">vehicles</span><span style="font-variant-ligatures:no-common-ligatures" class="">,
condition:</span> <span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">aboveSpeedLimit</span><span style="font-variant-ligatures:no-common-ligatures" class="">)&nbsp;
&nbsp; &nbsp; &nbsp;</span> <span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,143,0)" class="">//
Uh, T inferred to be Vehicle!</span></div><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
</p><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)" class="">let</span>
<span style="font-variant-ligatures:no-common-ligatures" class="">processedCars:
[</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">Car</span><span style="font-variant-ligatures:no-common-ligatures" class="">]
=</span> <span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">processAll</span><span style="font-variant-ligatures:no-common-ligatures" class="">(in:</span>
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">vehicles</span><span style="font-variant-ligatures:no-common-ligatures" class="">,
condition:</span> <span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">aboveSpeedLimit</span><span style="font-variant-ligatures:no-common-ligatures" class="">)
&nbsp; &nbsp;</span> <span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,143,0)" class="">//
T&nbsp;inferred to be&nbsp;Car</span></div><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
</p><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(0, 143, 0);" class="">
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">processAll</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&lt;</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">Bicycle</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&gt;(in:</span>
<span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">vehicles</span><span style="font-variant-ligatures: no-common-ligatures;" class="">,
condition:</span> <span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)" class="">aboveSpeedLimit</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp;</span> <span style="font-variant-ligatures:no-common-ligatures" class="">// This should be
allowed under this proposal</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""><br class=""></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""><br class=""></span></div><div style="margin: 0px; line-height: normal; font-family: menlo;" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""><b style="color:rgb(34,34,34);font-family:arial,sans-serif" class="">Notes<span style="font-size:11px" class="">:</span></b></span></div>
<div class=""><br class=""></div><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
</p><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class="">
</p>
<div class="">If necessary, the (real life) Swift code that lead to the
proposal could be shared.</div>
</div>
<div class=""><br class=""></div>
</div></div></div>


______________________________<wbr class="">_________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank" class="">https://lists.swift.org/mailma<wbr class="">n/listinfo/swift-evolution</a><br class=""></div></div></span></blockquote></div><div class="m_1528253077411346657m_-7327322934150946090bloop_markdown"><div class=""><br class="webkit-block-placeholder"></div></div></div></blockquote></div><br class=""></div>
</div></blockquote><blockquote type="cite" class=""><div class=""><span class="">______________________________<wbr class="">_________________</span><br class=""><span class="">swift-evolution mailing list</span><br class=""><span class=""><a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a></span><br class=""><span class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank" class="">https://lists.swift.org/<wbr class="">mailman/listinfo/swift-<wbr class="">evolution</a></span><br class=""></div></blockquote></div></div></div></blockquote></div><br class=""></div>
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></body></html>