<div><span style="color:rgb(49,49,49);word-spacing:1px;background-color:rgb(255,255,255)">&gt; If the answer to the above question is &quot;yes, T is inferred as Int&quot; then we need some way to express &quot;give me the default for T, which is Float.&quot;</span></div><div><span style="color:rgb(49,49,49);word-spacing:1px;background-color:rgb(255,255,255)"><br></span></div><div><span style="color:rgb(49,49,49);word-spacing:1px;background-color:rgb(255,255,255)">I don&#39;t think that we need that. It would introduce a new level of explicitness, &quot;I want the default, but I don&#39;t care what the default is&quot;, that is not really useful. If you don&#39;t care what the default type is, you probably also don&#39;t care that you are defaulting. If you do care what the default type is, you would explicitly sepecify it as `X&lt;Float&gt;`. </span></div><div><span style="color:rgb(49,49,49);word-spacing:1px;background-color:rgb(255,255,255)"><br></span></div><div><span style="color:rgb(49,49,49);word-spacing:1px;background-color:rgb(255,255,255)"><br></span></div><div><span style="color:rgb(49,49,49);word-spacing:1px;background-color:rgb(255,255,255)">&gt; If the answer to the above question is &quot;no&quot; then we need some way to express &quot;don&#39;t give me the default; rather, infer type T from the right hand side.&quot;</span><br></div><div><span style="color:rgb(49,49,49);word-spacing:1px;background-color:rgb(255,255,255)"><br></span></div><div><span style="color:rgb(49,49,49);word-spacing:1px;background-color:rgb(255,255,255)">That would be preferred behavior. Infer from the context if possible, use default otherwise. </span></div><div><span style="color:rgb(49,49,49);word-spacing:1px;background-color:rgb(255,255,255)"><br></span></div><div><br><div class="gmail_quote"><div>tir. 24. jan. 2017 kl. 05.11 skrev Xiaodi Wu &lt;<a href="mailto:xiaodi.wu@gmail.com">xiaodi.wu@gmail.com</a>&gt;:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_msg">While it looks nicer without the angle brackets, that suggestion is unresponsive to David&#39;s point that we need some way to distinguish defaulted generic arguments from inferred generic arguments.<div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Consider:</div><div class="gmail_msg">```</div><div class="gmail_msg">let a: Optional = 1 // Optional&lt;Int&gt;</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">enum FloatPreferringOptional&lt;T = Float&gt; {</div><div class="gmail_msg">  case some(T)</div><div class="gmail_msg">  case none</div><div class="gmail_msg">}</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">let b: FloatPreferringOptional = 1</div><div class="gmail_msg">// Does this give you an FloatPreferringOptional&lt;Int&gt;?</div><div class="gmail_msg">```</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">If the answer to the above question is &quot;yes, T is inferred as Int&quot; then we need some way to express &quot;give me the default for T, which is Float.&quot; If the answer to the above question is &quot;no&quot; then we need some way to express &quot;don&#39;t give me the default; rather, infer type T from the right hand side.&quot;</div></div><div class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg"><br class="gmail_msg"></div></div><div class="gmail_extra gmail_msg"><br class="gmail_msg"><div class="gmail_quote gmail_msg">On Mon, Jan 23, 2017 at 6:30 PM, Matthew Johnson via swift-evolution <span class="gmail_msg">&lt;<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br class="gmail_msg"><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="gmail_msg">This proposal looks good to me.  I have been looking forward to more flexible generic arguments for a while.<div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">I agree with previous commenters who prefer the option to leave off the angle brackets when all parameters have defaults.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">The proposal specifically mentions that the syntax is inspired by that of function arguments.  This is good, but I wonder if maybe we should draw further inspiration from function arguments and also add parameter labels for generic arguments.  Both feel like low hanging fruit in the generics area (correct me if I’m wrong about that) and it would be great to see both enhancements make it into Swift 4.</div><div 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"><div class="m_-4271769178076865979h5 gmail_msg"><div class="gmail_msg">On Jan 23, 2017, at 9:55 AM, Srđan Rašić via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div><br class="m_-4271769178076865979m_-2275226256302434135Apple-interchange-newline gmail_msg"></div></div><div class="gmail_msg"><div class="gmail_msg"><div class="m_-4271769178076865979h5 gmail_msg"><div class="gmail_msg">Hi Everyone,<div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">I&#39;ve opened a PR (<a href="https://github.com/apple/swift-evolution/pull/591" class="gmail_msg" target="_blank">https://github.com/apple/swift-evolution/pull/591</a>) proposing default generic arguments which I think would be nice addition to the language. They are also mentioned in &quot;Generic manifesto&quot;. </div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">The proposal is focusing around generic types. Generic functions are not coved by the proposal and I don&#39;t think that we need default generic arguments in generic functions as all the types are always part of the function signature so the compiler can always infer them. One corner case might be if using default argument values in which case support for default generic arguments in functions might be useful.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">It would be great to hear your opinions and suggestions so I can refine the proposal.<br class="gmail_msg"></div></div></div></div><span class="gmail_msg"><br><br>_______________________________________________<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" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="gmail_msg"></span></div></blockquote></div><br class="gmail_msg"></div></div></div><br class="gmail_msg">_______________________________________________<br class="gmail_msg"><br><br>swift-evolution mailing list<br class="gmail_msg"><br><br><a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="gmail_msg"><br><br><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"><br><br><br class="gmail_msg"></blockquote></div><br class="gmail_msg"></div></div></blockquote></div></div>