[swift-evolution] [Pitch] Moving where Clauses Out Of Parameter Lists
Sean Heber
sean at fifthace.com
Wed Apr 6 13:48:34 CDT 2016
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
{}
.. which would address my concerns about distance from names to params, too!
l8r
Sean
> On Apr 6, 2016, at 1:47 PM, Milos Rankovic via swift-evolution <swift-evolution at swift.org> wrote:
>
>
>> On 6 Apr 2016, at 19:35, Pyry Jahkola via swift-evolution <swift-evolution at swift.org> wrote:
>>
>> func anyCommonElements<T, U>(lhs: T, _ rhs: U) -> Bool
>> where T : SequenceType,
>> U : SequenceType,
>> T.Generator.Element: Equatable,
>> T.Generator.Element == U.Generator.Element
>> {
>> ...
>> }
>>
>
> This is an excellent idea: +1!
>
> If `where` is left on a previous line, it would also appear more in line with `throws`:
>
> func anyCommonElements<T, U>(lhs: T, _ rhs: U) -> Bool where
> T : SequenceType,
> U : SequenceType,
> T.Generator.Element: Equatable,
> T.Generator.Element == U.Generator.Element
> {
> ...
> }
>
>
> milos
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
More information about the swift-evolution
mailing list