[swift-evolution] [Review] SE-0081: Move where clause to end of declaration

Brent Royal-Gordon brent at architechies.com
Fri May 13 05:18:42 CDT 2016

> I’m a +1, however personally I’d prefer this to be optional my constraints aren’t that complex, for example:
> 	func someMethod<T where T.Element == String>(value:T) { … }
> Personally I prefer to keep such simple cases as they are, but would happily use the new ability to move more complex ones (e.g- dealing with Generator.Element and multiple constraints) to the end as proposed.

The example you give isn't actually a legal constraint. (The legal version would be much longer—you'd need to conform `T` to `Sequence` or `Collection` and test `T.Iterator.Element`, or their Swift 2 equivalents.) Can you provide a more realistic example where you think moving the `where` clause to the end of the declaration is overkill? I've generally found that most where clauses are mind-numbingly long.

Brent Royal-Gordon

More information about the swift-evolution mailing list