<div dir="ltr">I'm hoping this extends to type values.<div><br></div><div>struct StructWithClosure</div><div>{</div><div> let closure : (lhs: Element, rhs:Element) -> Range<Element> where Element : Incrementable, Comparable</div><div>}</div><div><br></div><div>or for that matter, protocol values:</div><div><br></div><div>struct StructWithIntCollectionType</div><div>{</div><div> let collection : C where C : CollectionType, C.Element == Int</div><div>}</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 7, 2016 at 1:13 AM, Brent Royal-Gordon via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span 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:<br>
><br>
> func anyCommonElements<T, U>(lhs: T, _ rhs: U) -> Bool<br>
> where T : SequenceType,<br>
> U : SequenceType,<br>
> T.Generator.Element: Equatable,<br>
> T.Generator.Element == U.Generator.Element<br>
> {<br>
> ...<br>
> }<br>
><br>
> That would make the definition look closer to what the call site looks like.<br>
><br>
> The same would work for generic types too:<br>
><br>
> public struct Dictionary<Key, Value><br>
> where Key : Hashable<br>
> {<br>
> ...<br>
> }<br>
<br>
</span>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>
<br>
func ..< <Element: Incrementable>(lhs: Element, rhs: Element) -> Range<Element><br>
where Element: Comparable, lhs <= rhs {<br>
…<br>
}<br>
<br>
I'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>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Brent Royal-Gordon<br>
Architechies<br>
</font></span><div class="HOEnZb"><div class="h5"><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>
</div></div></blockquote></div><br></div>