<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 != &lt;</div><div class=""><span class="Apple-tab-span" style="white-space:pre">                </span>A : Equatable,&nbsp;</div><div class=""><span class="Apple-tab-span" style="white-space:pre">                </span>B : Equatable,&nbsp;</div><div class=""><span class="Apple-tab-span" style="white-space:pre">                </span>C : Equatable,&nbsp;</div><div class=""><span class="Apple-tab-span" style="white-space:pre">                </span>D : Equatable,&nbsp;</div><div class=""><span class="Apple-tab-span" style="white-space:pre">                </span>E : Equatable,&nbsp;</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>&gt; (lhs: (A, B, C, D, E, F), rhs: (A, B, C, D, E, F)) -&gt; 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)) -&gt; Bool where &lt;</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>&gt;</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 &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; 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 &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; 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 &lt;T, U&gt;<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) -&gt; 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&lt;T, U&gt;</span><span style="font-family: Menlo-Regular; font-size: 11px;" class=""><b class="">(lhs: T, _ rhs: U) -&gt; Bool</b></span></div><div class=""><span style="font-family: Menlo-Regular; font-size: 11px;" class=""><b class=""><font color="#7b219f" class="">&nbsp; &nbsp; 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="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; U : SequenceType,</span><br style="font-family: Menlo-Regular; font-size: 11px;" class=""><span style="font-family: Menlo-Regular; font-size: 11px;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 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="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 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="">&nbsp; &nbsp; ...</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 &nbsp;too:</div><div class=""><br class=""></div><div class=""><font face="Menlo" style="font-size: 11px;" class="">public struct Dictionary&lt;Key, Value&gt;</font></div><div class=""><font face="Menlo" style="font-size: 11px;" class="">&nbsp; &nbsp; 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="">&nbsp; &nbsp;...</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>