[swift-evolution] [Pitch] Moving where Clauses Out Of Parameter Lists

Milos Rankovic milos at milos-and-slavica.net
Wed Apr 6 14:20:51 CDT 2016


> On 6 Apr 2016, at 19:48, Sean Heber <sean at fifthace.com> wrote:
> 
> This almost seems like it could work so that it didn't even need the bracketed parts to be able to figure out the types:
> 
> func anyCommonElements(lhs: T, _ rhs: U) -> Bool where
>    T : SequenceType,
>    U : SequenceType,
>    T.Generator.Element: Equatable,
>    T.Generator.Element == U.Generator.Element
> {}
> 

But if the brackets are kept, we may be able to do away with commas? For example, this Standard Library function:

    public func + <
        C : RangeReplaceableCollectionType,
        S : SequenceType
        where S.Generator.Element == C.Generator.Element
    > (lhs: C, rhs: S) -> C

would become:

    public func + (lhs: C, rhs: S) -> C where <
        C : RangeReplaceableCollectionType
        C : SequenceType
        S.Generator.Element == C.Generator.Element
    >
 
Brackets may also be needed for the api view of the library.

milos

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160406/f969ed3d/attachment.html>


More information about the swift-evolution mailing list