<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><blockquote type="cite" class="">This almost seems like it could work so that it didn't even need the bracketed parts to be able to figure out the types:<br class=""><div class=""><div class=""><br class="">func anyCommonElements(lhs: T, _ rhs: U) -> Bool where<br class=""> T : SequenceType,<br class=""> U : SequenceType,<br class=""> T.Generator.Element: Equatable,<br class=""> T.Generator.Element == U.Generator.Element<br class="">{}<br class=""></div></div></blockquote></div><br class=""><div class="">I'd still keep the generic arguments listed there in the brackets if only for the following reasons:</div><div class=""><br class=""></div><div class="">1. The new names get introduced (in `<font face="Menlo" style="font-size: 11px;" class=""><...></font>`) before their first use. So if you happened to name one of them `<font face="Menlo" style="font-size: 11px;" class="">String</font>`, it would be clear that you didn't mean `<font face="Menlo" style="font-size: 11px;" class="">Swift.String</font>`.</div><div class=""><br class=""></div><div class="">2. It's been sometimes wished that you could explicitly specify which specialisation you want to use, e.g. when passing a function into a handler (e.g. `<font face="Menlo" style="font-size: 11px;" class=""><b class="">let operation = anyCommonElements<[Int], [Int]>(_:_:)</b></font>`).</div><div class=""><br class=""></div><div class="">3. How would you otherwise mention a generic type if there were no constraints for it? I think the suggested form:</div><div class=""><br class=""></div><div class=""><font face="Menlo" style="font-size: 11px;" class="">extension Array<T> {</font></div><div class=""><font face="Menlo" style="font-size: 11px;" class=""> // no constraints needed (not for T above, not for U below)</font></div><div class=""><font face="Menlo" style="font-size: 11px;" class=""> <b class="">func map<U>(transform: T -> U) -> Array<U></b> { ... }</font></div><div class=""><font face="Menlo" style="font-size: 11px;" class="">}</font></div><div class=""><br class=""></div><div class="">reads better than this:</div><div class=""><br class=""></div><div class=""><div class=""><font face="Menlo" style="font-size: 11px;" class="">extension Array<T> {</font></div><div class=""><font face="Menlo" style="font-size: 11px;" class=""> <b class="">// Wait what, where did U come from?</b></font></div><div class=""><font face="Menlo" style="font-size: 11px;" class=""> func map(transform: T -> U) -> Array<U></font><span style="font-family: Menlo; font-size: 11px;" class=""> </span><span style="font-family: Menlo; font-size: 11px;" class="">{ ... }</span></div><div class=""><font face="Menlo" style="font-size: 11px;" class="">}</font></div></div><div class=""><br class=""></div><div class="">— Pyry</div></body></html>