> I would actually move them as far as after everything else, and right before 
> the definition body. For the above function that would mean:
> 
> func anyCommonElements<T, U>(lhs: T, _ rhs: U) -> Bool
>     where T : SequenceType,
>           U : SequenceType,
>           T.Generator.Element: Equatable,
>           T.Generator.Element == U.Generator.Element
> {
>     ...
> }
> 
> That would make the definition look closer to what the call site looks like.
> 
> The same would work for generic types  too:
> 
> public struct Dictionary<Key, Value>
>     where Key : Hashable
> {
>    ...
> }

Another nice thing about this style is that, in principle, I think it could be 
extended to specify requirements on non-type parameter values.

        func ..< <Element: Incrementable>(lhs: Element, rhs: Element) -> 
Range<Element>
                where Element: Comparable, lhs <= rhs {
                …
        }

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.

-- 
Brent Royal-Gordon
Architechies

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to