[swift-evolution] [swift-evolution-announce] [Review] SE-0089: Replace protocol<P1, P2> syntax with Any<P1, P2>
Austin Zheng
austinzheng at gmail.com
Sat May 28 12:35:12 CDT 2016
Sorry, 'with' in the second example should be 'where'. My personal preference is to keep 'where' for both uses, since they are serving the same purpose.
> On May 28, 2016, at 10:33 AM, Austin Zheng <austinzheng at gmail.com> wrote:
>>
>> -Thorsten
>
> We could make parentheses optional in the general case, and just have them mandatory in the following situations:
>
> - You want to nest an existential literal inside another existential literal:
> let a : Protocol1, (Protocol2 where .Blah == Int), Protocol3 = foo()
>
> - You want to return an existential with more than one term and/or a where clause from a function that has a generic where clause
> func foo<P, Q>(p: P, q: Q) -> (Collection with .Element == P) where P : Equatable { ... }
>
> - You want to use an existential as a function argument, and that existential has more than one term and/or a where clause
> func foo(x: Protocol1, y: (Protocol2 where .Blah == Int), z: Protocol3) { ... }
>
> Would that be a reasonable compromise?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160528/c0ec3cc2/attachment.html>
More information about the swift-evolution
mailing list