<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="">With `where` at the end, the Standard Library function:</div><div class=""><br class=""></div><div class=""><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>public func != <</div><div class=""><span class="Apple-tab-span" style="white-space:pre">                </span>A : Equatable, </div><div class=""><span class="Apple-tab-span" style="white-space:pre">                </span>B : Equatable, </div><div class=""><span class="Apple-tab-span" style="white-space:pre">                </span>C : Equatable, </div><div class=""><span class="Apple-tab-span" style="white-space:pre">                </span>D : Equatable, </div><div class=""><span class="Apple-tab-span" style="white-space:pre">                </span>E : Equatable, </div><div class=""><span class="Apple-tab-span" style="white-space:pre">                </span>F : Equatable</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>> (lhs: (A, B, C, D, E, F), rhs: (A, B, C, D, E, F)) -> Bool</div><div class=""><br class=""></div><div class="">becomes:</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>public func != (lhs: (A, B, C, D, E, F), rhs: (A, B, C, D, E, F)) -> Bool where <</div><div class=""><span class="Apple-tab-span" style="white-space:pre">                </span>A : Equatable,</div><div class=""><span class="Apple-tab-span" style="white-space:pre">                </span>B : Equatable,</div><div class=""><span class="Apple-tab-span" style="white-space:pre">                </span>C : Equatable,</div><div class=""><span class="Apple-tab-span" style="white-space:pre">                </span>D : Equatable,</div><div class=""><span class="Apple-tab-span" style="white-space:pre">                </span>E : Equatable,</div><div class=""><span class="Apple-tab-span" style="white-space:pre">                </span>F : Equatable</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>></div></div><div class="">milos</div><br class=""><div><blockquote type="cite" class=""><div class="">On 6 Apr 2016, at 19:35, Pyry Jahkola 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=""><blockquote type="cite" class="">On 06 Apr 2016, at 21:30, Developer via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class=""></blockquote><div class=""><blockquote type="cite" class=""><br class="Apple-interchange-newline"><div class=""><div class="">If you've ever gotten to the point where you have a sufficiently generic interface to a thing and you need to constrain it, possibly in an extension, maybe for a generic free function or operator, you know what a pain the syntax can be for these kinds of operations. </div></div></blockquote><div class=""><br class=""></div><div class="">+1 already!</div><br class=""><blockquote type="cite" class=""><div class=""><div class="">Or, if you're feeling ambitious, even<br class=""><br class="">func anyCommonElements <T, U><br class="">where T : SequenceType, U : SequenceType,<br class="">T.Generator.Element: Equatable, T.Generator.Element == U.Generator.Element<br class="">(lhs: T, _ rhs: U) -> Bool<br class=""></div></div></blockquote></div><br class=""><div class="">I would actually move them as far as after everything else, and right before the definition body. For the above function that would mean:</div><div class=""><br class=""></div><div class=""><span style="font-weight: bold; font-family: Menlo-Regular; font-size: 11px;" class="">func anyCommonElements<T, U></span><span style="font-family: Menlo-Regular; font-size: 11px;" class=""><b class="">(lhs: T, _ rhs: U) -> Bool</b></span></div><div class=""><span style="font-family: Menlo-Regular; font-size: 11px;" class=""><b class=""><font color="#7b219f" class=""> where T : SequenceType,</font></b></span></div><div class=""><b class=""><font color="#7b219f" class=""><span style="font-family: Menlo-Regular; font-size: 11px;" class=""> U : SequenceType,</span><br style="font-family: Menlo-Regular; font-size: 11px;" class=""><span style="font-family: Menlo-Regular; font-size: 11px;" class=""> T.Generator.Element: Equatable,</span></font></b></div><div class=""><b class=""><font color="#7b219f" class=""><span style="font-family: Menlo-Regular; font-size: 11px;" class=""> T.Generator.Element == U.Generator.Element</span><br style="font-family: Menlo-Regular; font-size: 11px;" class=""></font></b></div><div class=""><span style="font-family: Menlo-Regular; font-size: 11px;" class="">{</span></div><div class=""><span style="font-family: Menlo-Regular; font-size: 11px;" class=""> ...</span></div><div class=""><span style="font-family: Menlo-Regular; font-size: 11px;" class="">}</span></div><br class="">
That would make the definition look closer to what the call site looks like.<div class=""><br class=""></div><div class="">The same would work for generic types too:</div><div class=""><br class=""></div><div class=""><font face="Menlo" style="font-size: 11px;" class="">public struct Dictionary<Key, Value></font></div><div class=""><font face="Menlo" style="font-size: 11px;" class=""> where Key : Hashable</font></div><div class=""><font face="Menlo" style="font-size: 11px;" class="">{</font></div><div class=""><font face="Menlo" style="font-size: 11px;" class=""> ...</font></div><div class=""><font face="Menlo" style="font-size: 11px;" class="">}</font></div><div class=""><br class=""></div><div class="">— Pyry</div></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>