> On May 2, 2016, at 12:16 AM, David Hart via swift-evolution 
> <swift-evolution@swift.org> wrote:
> 
> Hello swift-evolution,
> 
> I took the pitch originally from Developer to move the where clause out of 
> the generic parameter list, with improvements brought up by Pyry Jahkola, and 
> wrote a proposal for it. I opened a Pull Request, but if anybody wants to 
> bring some modifications to it before it is merged, please let me know what 
> you think:
> 
> Move where clause to end of declaration
> 
> Proposal: SE-XXXX 
> <https://github.com/apple/swift-evolution/blob/master/proposals/XXXX-move-where-expression.md>
> Author(s): David Hart <https://github.com/hartbit>, Developer, Pry Jahkola 
> <https://github.com/hartbit/swift-evolution/blob/move-where-clause/proposals/pyry.jahk...@iki.fi>
> Status: TBD
> Review manager: TBD
>  
> <https://github.com/hartbit/swift-evolution/blob/move-where-clause/proposals/XXXX-move-where-expression.md#introduction>Introduction
> 
> This proposal suggests moving the where clause to the end of the declaration 
> syntax, but before the body, for readability reasons. It has been discussed 
> at length on the following swift-evolution thread:
> 
> [Pitch] Moving where Clauses Out Of Parameter Lists 
> <https://github.com/hartbit/swift-evolution/blob/move-where-clause/proposals/GMANE_DOWN_FOR_NOW>
>  
> <https://github.com/hartbit/swift-evolution/blob/move-where-clause/proposals/XXXX-move-where-expression.md#motivation>Motivation
> 
> The where clause in declarations can become quite long. When that happens, it 
> breaks the declaration syntax in two, hurting its readability. There is also 
> no good way of formatting the declaration syntax to make it much better.
> 
>  
> <https://github.com/hartbit/swift-evolution/blob/move-where-clause/proposals/XXXX-move-where-expression.md#proposed-solution>Proposed
>  solution
> 
> The proposal suggests moving the where clause at the end of the declaration, 
> but before the body of concerned declarations. With the proposed change, 
> where clauses do not impede the main declaration and are also more easily 
> formattable. For example, here is the same function declaration before and 
> after the change: 
> 
> func anyCommonElements<T : SequenceType, U : SequenceType where
>     T.Generator.Element: Equatable,
>     T.Generator.Element == U.Generator.Element>(lhs: T, _ rhs: U) -> Bool 
> where
> {
>     ...
> }
> 
> func anyCommonElements<T : SequenceType, U : SequenceType>(lhs: T, _ rhs: U) 
> -> Bool where
>     T.Generator.Element: Equatable,
>     T.Generator.Element == U.Generator.Element
> {
>     …
Random minor comment: I find that putting the “where” at the end makes this 
almost unreadable, and would very much have preferred

> func anyCommonElements<T : SequenceType, U : SequenceType>(lhs: T, _ rhs: U) 
> -> Bool
>     where T.Generator.Element: Equatable, T.Generator.Element == 
> U.Generator.Element


        - Doug

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to