Move where clause to end of declaration


(David Hart) #1

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.jahkola@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
{
    ...
}
This proposal has no impact on extension declarations with constraints because those declarations already have the where clauses right before the body. In that regard, the proposal makes the other declarations more consistent with extension declarations.

<https://github.com/hartbit/swift-evolution/blob/move-where-clause/proposals/XXXX-move-where-expression.md#detailed-design>Detailed design

First of all, the grammar of generic-parameter-clause is modified to loose the requirement- clause:

generic-parameter-clause → < ­generic-parameter-list­­ >­

The grammar of declarations are then amended to gain the requirement-clause:

function-declaration → function-head­ function-name­ generic-parameter-clause­opt­ function-signature requirement-clause­opt ­function-body­opt

union-style-enum → indirect­­opt­ ­enum ­enum-name ­generic-parameter-clause­­opt ­type-inheritance-clause­­opt­ requirement-clause­opt { ­union-style-enum-members­­opt­ }

raw-value-style-enum → enum ­enum-name­ generic-parameter-clause­­opt ­type-inheritance-clause requirement-clause­opt ­{ ­raw-value-style-enum-members­ *}­*

struct-declaration → attributes­­opt ­access-level-modifier­­opt ­struct ­struct-name ­generic-parameter-clause­­opt ­type-inheritance-clause­­opt requirement-clause­opt ­struct-body­

class-declaration → attributes­­opt ­access-level-modifier­opt ­final­opt ­class ­class-name ­generic-parameter-clause­opt ­type-inheritance-clause­opt requirement-clause­opt ­class-body­

protocol-method-declaration → function-head ­function-name ­generic-parameter-clause­­opt ­function-signature­ requirement-clause­opt

protocol-initializer-declaration → initializer-head ­generic-parameter-clause­­opt ­parameter-clause ­throws­­opt­ requirement-clause­opt

protocol-initializer-declaration → initializer-head ­generic-parameter-clause­opt ­parameter-clause­ rethrows­ requirement-clause­opt

initializer-declaration → initializer-head ­generic-parameter-clause­­opt ­parameter-clause ­throws­opt requirement-clause­opt ­initializer-body­

initializer-declaration → initializer-head ­generic-parameter-clause­opt ­parameter-clause ­rethrows requirement-clause­opt ­initializer-body­

<https://github.com/hartbit/swift-evolution/blob/move-where-clause/proposals/XXXX-move-where-expression.md#impact-on-existing-code>Impact on existing code

This proposal impacts all declarations which contain where clauses expect for extension declarations and will therefore require a Fix-It.

<https://github.com/hartbit/swift-evolution/blob/move-where-clause/proposals/XXXX-move-where-expression.md#alternatives-considered>Alternatives considered

The first post in the swift-evolution thread originally proposed moving the where clause just after the generic type declaration. Since then, the original author and many other participants in the thread have agreed that the current proposal is superior.

It was also proposed to remove the simple inheritance constraints from the generic parameter list, but several arguments were brought up that it would complicate declarations of simple generics which only needed inheritance constraints.


(Robert Widmann) #2

Hi there, just wanted to let you know I have a name! It's unfortunate that the mailing list won't accept the update I've made (this has been the 3rd-ish time I've tried).

~Robert Widmann

2016/05/02 3:16、David Hart <david@hartbit.com> のメッセージ:

···

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
Author(s): David Hart, Developer, Pry Jahkola
Status: TBD
Review manager: TBD
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

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.

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
{
    ...
}
This proposal has no impact on extension declarations with constraints because those declarations already have the where clauses right before the body. In that regard, the proposal makes the other declarations more consistent with extension declarations.

Detailed design

First of all, the grammar of generic-parameter-clause is modified to loose the requirement- clause:

generic-parameter-clause → < generic-parameter-list >

The grammar of declarations are then amended to gain the requirement-clause:

function-declaration → function-head function-name generic-parameter-clauseopt function-signature requirement-clauseopt function-bodyopt

union-style-enum → indirectopt enum enum-name generic-parameter-clauseopt type-inheritance-clauseopt requirement-clauseopt { union-style-enum-membersopt }

raw-value-style-enum → enum enum-name generic-parameter-clauseopt type-inheritance-clause requirement-clauseopt { raw-value-style-enum-members *}*

struct-declaration → attributesopt access-level-modifieropt struct struct-name generic-parameter-clauseopt type-inheritance-clauseopt requirement-clauseopt struct-body

class-declaration → attributesopt access-level-modifieropt finalopt class class-name generic-parameter-clauseopt type-inheritance-clauseopt requirement-clauseopt class-body

protocol-method-declaration → function-head function-name generic-parameter-clauseopt function-signature requirement-clauseopt

protocol-initializer-declaration → initializer-head generic-parameter-clauseopt parameter-clause throwsopt requirement-clauseopt

protocol-initializer-declaration → initializer-head generic-parameter-clauseopt parameter-clause rethrows requirement-clauseopt

initializer-declaration → initializer-head generic-parameter-clauseopt parameter-clause throwsopt requirement-clauseopt initializer-body

initializer-declaration → initializer-head generic-parameter-clauseopt parameter-clause rethrows requirement-clauseopt initializer-body

Impact on existing code

This proposal impacts all declarations which contain where clauses expect for extension declarations and will therefore require a Fix-It.

Alternatives considered

The first post in the swift-evolution thread originally proposed moving the where clause just after the generic type declaration. Since then, the original author and many other participants in the thread have agreed that the current proposal is superior.

It was also proposed to remove the simple inheritance constraints from the generic parameter list, but several arguments were brought up that it would complicate declarations of simple generics which only needed inheritance constraints.


#3

Hello

You have an extra where dangling in the from example

Dany

···

Le 2 mai 2016 à 03:16, David Hart via swift-evolution <swift-evolution@swift.org> a écrit :
:
func anyCommonElements<T : SequenceType, U : SequenceType where
    T.Generator.Element: Equatable,
    T.Generator.Element == U.Generator.Element>(lhs: T, _ rhs: U) -> Bool where
{
    ...
}


(David Hart) #4

I'll update the proposal ASAP :slight_smile: Btw, wasn't sure if you wanted to be cited as co-author because I did not have your express approval, but I thought it was the right thing to do. Was in a bit in a hurry to send the Pull Request before going to work.

···

On 02 May 2016, at 09:20, Developer <devteam.codafi@gmail.com> wrote:

Hi there, just wanted to let you know I have a name! It's unfortunate that the mailing list won't accept the update I've made (this has been the 3rd-ish time I've tried).

~Robert Widmann

2016/05/02 3:16、David Hart <david@hartbit.com> のメッセージ:

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
Author(s): David Hart, Developer, Pry Jahkola
Status: TBD
Review manager: TBD
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

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.

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
{
    ...
}
This proposal has no impact on extension declarations with constraints because those declarations already have the where clauses right before the body. In that regard, the proposal makes the other declarations more consistent with extension declarations.

Detailed design

First of all, the grammar of generic-parameter-clause is modified to loose the requirement- clause:

generic-parameter-clause → < ­generic-parameter-list­­ >­

The grammar of declarations are then amended to gain the requirement-clause:

function-declaration → function-head­ function-name­ generic-parameter-clause­opt­ function-signature requirement-clause­opt ­function-body­opt

union-style-enum → indirect­­opt­ ­enum ­enum-name ­generic-parameter-clause­­opt ­type-inheritance-clause­­opt­ requirement-clause­opt { ­union-style-enum-members­­opt­ }

raw-value-style-enum → enum ­enum-name­ generic-parameter-clause­­opt ­type-inheritance-clause requirement-clause­opt ­{ ­raw-value-style-enum-members­ *}­*

struct-declaration → attributes­­opt ­access-level-modifier­­opt ­struct ­struct-name ­generic-parameter-clause­­opt ­type-inheritance-clause­­opt requirement-clause­opt ­struct-body­

class-declaration → attributes­­opt ­access-level-modifier­opt ­final­opt ­class ­class-name ­generic-parameter-clause­opt ­type-inheritance-clause­opt requirement-clause­opt ­class-body­

protocol-method-declaration → function-head ­function-name ­generic-parameter-clause­­opt ­function-signature­ requirement-clause­opt

protocol-initializer-declaration → initializer-head ­generic-parameter-clause­­opt ­parameter-clause ­throws­­opt­ requirement-clause­opt

protocol-initializer-declaration → initializer-head ­generic-parameter-clause­opt ­parameter-clause­ rethrows­ requirement-clause­opt

initializer-declaration → initializer-head ­generic-parameter-clause­­opt ­parameter-clause ­throws­opt requirement-clause­opt ­initializer-body­

initializer-declaration → initializer-head ­generic-parameter-clause­opt ­parameter-clause ­rethrows requirement-clause­opt ­initializer-body­

Impact on existing code

This proposal impacts all declarations which contain where clauses expect for extension declarations and will therefore require a Fix-It.

Alternatives considered

The first post in the swift-evolution thread originally proposed moving the where clause just after the generic type declaration. Since then, the original author and many other participants in the thread have agreed that the current proposal is superior.

It was also proposed to remove the simple inheritance constraints from the generic parameter list, but several arguments were brought up that it would complicate declarations of simple generics which only needed inheritance constraints.


(Pyry Jahkola) #5

Thank you for the effort David, this is great!

Considering this example:

For example, here is the same function declaration (…) after the change:
func anyCommonElements<T : SequenceType, U : SequenceType>(lhs: T, _ rhs: U) -> Bool where
    T.Generator.Element: Equatable,
    T.Generator.Element == U.Generator.Element
{
    ...
}

I originally had the opinion that this should be further changed for consistency into the following form:

func anyCommonElements<T, U>(lhs: T, _ rhs: U) -> Bool where
    T : SequenceType,
    U : SequenceType,
    T.Generator.Element : Equatable,
    T.Generator.Element == U.Generator.Element
{
    ...
}
However, I do agree now that in the simple case highlighted below it makes no sense to use the where clause at all:

It was also proposed to remove the simple inheritance constraints from the generic parameter list, but several arguments were brought up that it would complicate declarations of simple generics which only needed inheritance constraints.

Of course, the proposal doesn't prevent anyone from moving all inheritance constraints into the where clause, so maybe we should point out that it's also possible to further simplify the first line of function declarations that way. It just remains a stylistic choice left for the developer to choose.

Anyway, +1! Did you make a pull request already?

— Pyry

···

On 02 May 2016, David Hart <david@hartbit.com> wrote:


(David Hart) #6

Nice catch!

···

On 02 May 2016, at 11:58, Dany St-Amant via swift-evolution <swift-evolution@swift.org> wrote:

Hello

You have an extra where dangling in the from example

Dany

Le 2 mai 2016 à 03:16, David Hart via swift-evolution <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> a écrit :
:

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

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


(Douglas Gregor) #7

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.jahkola@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

···

On May 2, 2016, at 12:16 AM, David Hart via swift-evolution <swift-evolution@swift.org> wrote:


(David Hart) #8

Name updated: https://github.com/apple/swift-evolution/pull/281

···

On 02 May 2016, at 09:39, David Hart <david@hartbit.com> wrote:

I'll update the proposal ASAP :slight_smile: Btw, wasn't sure if you wanted to be cited as co-author because I did not have your express approval, but I thought it was the right thing to do. Was in a bit in a hurry to send the Pull Request before going to work.

On 02 May 2016, at 09:20, Developer <devteam.codafi@gmail.com <mailto:devteam.codafi@gmail.com>> wrote:

Hi there, just wanted to let you know I have a name! It's unfortunate that the mailing list won't accept the update I've made (this has been the 3rd-ish time I've tried).

~Robert Widmann

2016/05/02 3:16、David Hart <david@hartbit.com <mailto:david@hartbit.com>> のメッセージ:

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.jahkola@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
{
    ...
}
This proposal has no impact on extension declarations with constraints because those declarations already have the where clauses right before the body. In that regard, the proposal makes the other declarations more consistent with extension declarations.

<https://github.com/hartbit/swift-evolution/blob/move-where-clause/proposals/XXXX-move-where-expression.md#detailed-design>Detailed design

First of all, the grammar of generic-parameter-clause is modified to loose the requirement- clause:

generic-parameter-clause → < ­generic-parameter-list­­ >­

The grammar of declarations are then amended to gain the requirement-clause:

function-declaration → function-head­ function-name­ generic-parameter-clause­opt­ function-signature requirement-clause­opt ­function-body­opt

union-style-enum → indirect­­opt­ ­enum ­enum-name ­generic-parameter-clause­­opt ­type-inheritance-clause­­opt­ requirement-clause­opt { ­union-style-enum-members­­opt­ }

raw-value-style-enum → enum ­enum-name­ generic-parameter-clause­­opt ­type-inheritance-clause requirement-clause­opt ­{ ­raw-value-style-enum-members­ *}­*

struct-declaration → attributes­­opt ­access-level-modifier­­opt ­struct ­struct-name ­generic-parameter-clause­­opt ­type-inheritance-clause­­opt requirement-clause­opt ­struct-body­

class-declaration → attributes­­opt ­access-level-modifier­opt ­final­opt ­class ­class-name ­generic-parameter-clause­opt ­type-inheritance-clause­opt requirement-clause­opt ­class-body­

protocol-method-declaration → function-head ­function-name ­generic-parameter-clause­­opt ­function-signature­ requirement-clause­opt

protocol-initializer-declaration → initializer-head ­generic-parameter-clause­­opt ­parameter-clause ­throws­­opt­ requirement-clause­opt

protocol-initializer-declaration → initializer-head ­generic-parameter-clause­opt ­parameter-clause­ rethrows­ requirement-clause­opt

initializer-declaration → initializer-head ­generic-parameter-clause­­opt ­parameter-clause ­throws­opt requirement-clause­opt ­initializer-body­

initializer-declaration → initializer-head ­generic-parameter-clause­opt ­parameter-clause ­rethrows requirement-clause­opt ­initializer-body­

<https://github.com/hartbit/swift-evolution/blob/move-where-clause/proposals/XXXX-move-where-expression.md#impact-on-existing-code>Impact on existing code

This proposal impacts all declarations which contain where clauses expect for extension declarations and will therefore require a Fix-It.

<https://github.com/hartbit/swift-evolution/blob/move-where-clause/proposals/XXXX-move-where-expression.md#alternatives-considered>Alternatives considered

The first post in the swift-evolution thread originally proposed moving the where clause just after the generic type declaration. Since then, the original author and many other participants in the thread have agreed that the current proposal is superior.

It was also proposed to remove the simple inheritance constraints from the generic parameter list, but several arguments were brought up that it would complicate declarations of simple generics which only needed inheritance constraints.


(David Hart) #9

Yep, I made a pull request already, but I still need to fix the thread link once games becomes available again. I’ll add an example about the current proposal allowing you to move the inheritance constraints out :slight_smile: It’s good to have the choice.

···

On 02 May 2016, at 10:11, Pyry Jahkola <pyry.jahkola@iki.fi> wrote:

Thank you for the effort David, this is great!

Considering this example:

On 02 May 2016, David Hart <david@hartbit.com <mailto:david@hartbit.com>> wrote:

For example, here is the same function declaration (…) after the change:
func anyCommonElements<T : SequenceType, U : SequenceType>(lhs: T, _ rhs: U) -> Bool where
    T.Generator.Element: Equatable,
    T.Generator.Element == U.Generator.Element
{
    ...
}

I originally had the opinion that this should be further changed for consistency into the following form:

func anyCommonElements<T, U>(lhs: T, _ rhs: U) -> Bool where
    T : SequenceType,
    U : SequenceType,
    T.Generator.Element : Equatable,
    T.Generator.Element == U.Generator.Element
{
    ...
}
However, I do agree now that in the simple case highlighted below it makes no sense to use the where clause at all:

It was also proposed to remove the simple inheritance constraints from the generic parameter list, but several arguments were brought up that it would complicate declarations of simple generics which only needed inheritance constraints.

Of course, the proposal doesn't prevent anyone from moving all inheritance constraints into the where clause, so maybe we should point out that it's also possible to further simplify the first line of function declarations that way. It just remains a stylistic choice left for the developer to choose.

Anyway, +1! Did you make a pull request already?

— Pyry