Where-clauses outside of generic parameter lists

Originator:jonsterling
Number:rdar://17203060 Date Originated:
Status:Open Resolved:
Product:Developer Tools Product Version:
Classification: Reproducible:
 
Summary:
I was very pleased to see that Swift has ML-style sharing constraints in generic parameter lists. An extension to this behavior would make protocols vastly more useful, as described below.

Steps to Reproduce:
Consider the following (hypothetical) code:

````
protocol S {
    typealias A
    typealias B
}

protocol T {
    typealias X : S where X.A == X.B
}
````

Expected Results:
This should create a protocol with an abstract type member `X` constrained by protocol `S`, and the following sharing constraints: `X.A == X.B`.

It would be ideal to model this feature off the way that where-clauses work in Standard ML. This way we can maintain abstraction at the same time as choosing which information escapes in a very deliberate way.

Actual Results:
This behavior is in fact not supported in Swift.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!