<div dir="ltr">I like the idea, I find the beginning of a declaration too cluttered and it obscures the main purpose. Like Brent I am wary of the design by contract (DBC) bit, `lhs &lt;= rhs`. DBC is probably for a separate discussion, but moving the where clause would probably help.</div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature">  -- Howard.<br></div></div>
<br><div class="gmail_quote">On 7 April 2016 at 10:36, Matthew Johnson via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
Sent from my iPad<br>
<br>
On Apr 6, 2016, at 7:13 PM, Brent Royal-Gordon via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:<br>
<br>
&gt;&gt; I would actually move them as far as after everything else, and right before the definition body. For the above function that would mean:<br>
&gt;&gt;<br>
&gt;&gt; func anyCommonElements&lt;T, U&gt;(lhs: T, _ rhs: U) -&gt; Bool<br>
&gt;&gt;    where T : SequenceType,<br>
&gt;&gt;          U : SequenceType,<br>
&gt;&gt;          T.Generator.Element: Equatable,<br>
&gt;&gt;          T.Generator.Element == U.Generator.Element<br>
&gt;&gt; {<br>
&gt;&gt;    ...<br>
&gt;&gt; }<br>
&gt;&gt;<br>
&gt;&gt; That would make the definition look closer to what the call site looks like.<br>
&gt;&gt;<br>
&gt;&gt; The same would work for generic types  too:<br>
&gt;&gt;<br>
&gt;&gt; public struct Dictionary&lt;Key, Value&gt;<br>
&gt;&gt;    where Key : Hashable<br>
&gt;&gt; {<br>
&gt;&gt;   ...<br>
&gt;&gt; }<br>
&gt;<br>
&gt; Another nice thing about this style is that, in principle, I think it could be extended to specify requirements on non-type parameter values.<br>
&gt;<br>
&gt;    func ..&lt; &lt;Element: Incrementable&gt;(lhs: Element, rhs: Element) -&gt; Range&lt;Element&gt;<br>
&gt;        where Element: Comparable, lhs &lt;= rhs {<br>
&gt;        …<br>
&gt;    }<br>
&gt;<br>
&gt; I&#39;m not saying we must or even should include that feature, merely that it gives us a nice syntactic slot to use if we choose to do so later.<br>
<br>
I know you&#39;re not proposing that feature right now, but want to understand how you expect it to work.  It looks to me like this starts to enter design by contract territory.  Would the predicate behave as if it was part of a precondition?<br>
<br>
&gt; --<br>
&gt; Brent Royal-Gordon<br>
&gt; Architechies<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; swift-evolution mailing list<br>
&gt; <a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
&gt; <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</blockquote></div><br></div>