<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><br>Sent from my iPhone</div><div><br>On 30 Nov 2016, at 06:40, David Hart via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=utf-8">For example, here is a design pattern I would find clearer with explicit type information:<div class=""><br class=""></div><div class="">let cat = factory.get<Cat>()</div><div class=""><br class=""></div><div class="">vs</div><div class=""><br class=""></div><div class="">let cat: Cat = factory.get()</div><div class=""><br class=""></div><div class="">Having the explicit type information in angle brackets allows us to move the type information closer to where it make sense.</div><div class=""><br class=""></div></div></blockquote><div><br></div><div>Agreed :).</div><div><br></div><blockquote type="cite"><div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 29 Nov 2016, at 23:52, Douglas Gregor via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Nov 29, 2016, at 8:00 AM, Derrick Ho via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="white-space:pre-wrap" class="">I don't think the angle brackets adds any additional benefit than adding the type information as a parameter. Adding Angle brackets will just make it more crowded….</div></div></blockquote><div class=""><br class=""></div><div class="">Adding the type information as a parameter effectively disables type inference for that parameter, because you have to pass the parameter explicitly. In some cases, like the unsafeBitCast function I pointed out, that is a good thing. In other cases, type inference might do the right thing for most callers, but specific call sites want the extra control provided by explicitly specifying generic arguments. 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.</div><div class=""><br class=""></div><blockquote type="cite" class=""><div class=""><div style="white-space:pre-wrap" class="">plus, the syntax just seems too much like c++</div></div></blockquote><div class=""><br class=""></div><div class="">Lots of languages use angle brackets like this; Swift has it for types already, so I find this an odd criticism.</div><div class=""><br class=""></div><span class="Apple-tab-span" style="white-space:pre">        </span>- Doug</div><div class=""><br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_quote gmail_msg"><div dir="ltr" class="gmail_msg">On Tue, Nov 29, 2016 at 8:43 AM Goffredo Marocchi via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a>> 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="auto" class="gmail_msg"><div class="gmail_msg">I think this is a case where the angle bran jets is both more readable and terse without losing context... opinions and all :).<br class="gmail_msg"><br class="gmail_msg">Sent from my iPhone</div></div><div dir="auto" class="gmail_msg"><div class="gmail_msg"><br class="gmail_msg">On 29 Nov 2016, at 09:47, Andrew Trick via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a>> wrote:<br class="gmail_msg"><br class="gmail_msg"></div><blockquote type="cite" class="gmail_msg"><div class="gmail_msg"><br class="gmail_msg"><div class="gmail_msg"><blockquote type="cite" class="gmail_msg"><div class="gmail_msg">On Nov 28, 2016, at 10:11 PM, Douglas Gregor via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a>> wrote:</div><br class="m_317495992112241871m_-2571131196061471686Apple-interchange-newline gmail_msg"><div class="gmail_msg"><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="gmail_msg"><blockquote type="cite" class="gmail_msg"><div class="gmail_msg"><br class="m_317495992112241871m_-2571131196061471686Apple-interchange-newline gmail_msg">On Nov 21, 2016, at 3:05 PM, Ramiro Feria Purón via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a>> wrote:</div><br class="m_317495992112241871m_-2571131196061471686Apple-interchange-newline gmail_msg"><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"><span class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span>f<T>(</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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span>t:<span class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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="gmail_msg m_317495992112241871m_-2571131196061471686webkit-block-placeholder"></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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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">"xzcvzxcvx"</span><span style="font-family:menlo;font-size:11px;font-variant-ligatures:no-common-ligatures" class="gmail_msg">) <span class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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"><span class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span>g<T>(</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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span>x:<span class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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">) -> [</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="gmail_msg m_317495992112241871m_-2571131196061471686webkit-block-placeholder"></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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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"><span class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span>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="gmail_msg m_317495992112241871m_-2571131196061471686webkit-block-placeholder"></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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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 m_317495992112241871m_-2571131196061471686webkit-block-placeholder"></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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span>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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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"><span class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span>array =<span class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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"><span class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span>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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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"><</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">>(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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span>=<span class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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"><</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">>(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"><span class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span>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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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"><span class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span>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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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"><span class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span>Bicycle:<span class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span>{</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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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"><span class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span>Car:<span class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span>{</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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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"><span class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span>processAll<T:<span class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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">>(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">) -><span class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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><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="gmail_msg m_317495992112241871m_-2571131196061471686webkit-block-placeholder"></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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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"><span class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span>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="gmail_msg m_317495992112241871m_-2571131196061471686webkit-block-placeholder"></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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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"><span class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span>vehicle<span class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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"><span class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span>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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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"><span class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span>t = vehicle<span class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span>{<span class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span>}</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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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="gmail_msg m_317495992112241871m_-2571131196061471686webkit-block-placeholder"></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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span>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"><span class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span>aboveSpeedLimit(vehicle:<span class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span>{</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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span>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"> >= 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"><span class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span>processedVehicles =<span class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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"><span class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span>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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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"><</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">>(in:<span class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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 class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-converted-space"> </span></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 style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" 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 style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="gmail_msg"><br class="gmail_msg"></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="gmail_msg"><span class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-tab-span" style="white-space:pre-wrap">        </span>func unsafeBitCast<T, U>(_ x: T, to: U.Type) -> U</div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="gmail_msg"><br class="gmail_msg"></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" 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 style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="gmail_msg"><br class="gmail_msg"></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="gmail_msg"><div class="gmail_msg"><span class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-tab-span" style="white-space:pre-wrap">        </span>func unsafeBitCast<U, T>(_ x: T) -> 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="gmail_msg m_317495992112241871m_-2571131196061471686Apple-tab-span" style="white-space:pre-wrap">        </span>unsafeBitCast<Int>(something)<span class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-tab-span" style="white-space:pre-wrap">        </span>// slightly prettier, but…</div></div></div></blockquote><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Angle brackets in function calls are hideous. This is objectively more clear and much prettier IMO:</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"> unsafeBitCast(something, to: Int)</div><br class="gmail_msg"><blockquote type="cite" class="gmail_msg"><div class="gmail_msg"><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="gmail_msg"><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="gmail_msg m_317495992112241871m_-2571131196061471686Apple-tab-span" style="white-space:pre-wrap">        </span>foo(unsafeBitCast(something))<span class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-tab-span" style="white-space:pre-wrap">        </span>// just cast it to.. whatever<span class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-tab-span" style="white-space:pre-wrap">        </span></div></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="gmail_msg"><br class="gmail_msg"></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="gmail_msg">which is… not great.</div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="gmail_msg"><br class="gmail_msg"></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" 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 style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="gmail_msg"><br class="gmail_msg"></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="gmail_msg"><span class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-tab-span" style="white-space:pre-wrap">        </span>func f<T>() -> Void { … } // error: T is not part of the signature of f()</div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="gmail_msg"><br class="gmail_msg"></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" 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 style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="gmail_msg"><br class="gmail_msg"></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" 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></blockquote><div class="gmail_msg"><br class="gmail_msg"></div>+1 for required type parameters being normal parameters.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">I think the case mentioned in the proposal reads much better as:</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"> processAll(in: vehicles, as: Bicycle, condition: aboveSpeedLimit)<br class="gmail_msg"></div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">If angle brackets can be limited to generic definitions and type names, that’s a great accomplishment.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">-Andy</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><blockquote type="cite" class="gmail_msg"><div class="gmail_msg"><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="gmail_msg"><br class="gmail_msg"></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="gmail_msg">And, as Dave notes, it’s effectively syntactic sugar, so it belongs in Swift 4 stage 2.</div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="gmail_msg"><br class="gmail_msg"></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="gmail_msg"><span class="gmail_msg m_317495992112241871m_-2571131196061471686Apple-tab-span" style="white-space:pre-wrap">        </span>- Doug</div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="gmail_msg"><br class="gmail_msg"></div><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="gmail_msg"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important" class="gmail_msg">_______________________________________________</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="gmail_msg"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important" class="gmail_msg">swift-evolution mailing list</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="gmail_msg"><a href="mailto:swift-evolution@swift.org" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="gmail_msg"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div><br class="gmail_msg"></div></blockquote><blockquote type="cite" class="gmail_msg"><div class="gmail_msg"><span class="gmail_msg">_______________________________________________</span><br class="gmail_msg"><span class="gmail_msg">swift-evolution mailing list</span><br class="gmail_msg"><span class="gmail_msg"><a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a></span><br class="gmail_msg"><span class="gmail_msg"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br class="gmail_msg"></div></blockquote></div>_______________________________________________<br class="gmail_msg">
swift-evolution mailing list<br class="gmail_msg">
<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="gmail_msg">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="gmail_msg">
</blockquote></div>
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></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=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class=""></div></div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></body></html>