[swift-evolution] [Review] SE-0089: Replace protocol<P1, P2> syntax with Any<P1, P2>

Thorsten Seitz tseitz42 at icloud.com
Wed May 25 08:57:34 CDT 2016





     https://github.com/apple/swift-evolution/blob/master/proposals/0095-any-as-existential.md

   * What is your evaluation of the proposal?


+1. This proposal is a first step for generalized existentials.


-1 for Any<>

+1 for any<>

Reason: any<> is not a generic type and in the order of the type parameters supplied to any<> is not important which is very different from generic argument lists



An alternative might by a completely different syntax not using angled brackets which enclose type parameter lists, e.g. any[P, Q] or Any[P, Q] or P & Q.

The latter makes it difficult to add constraints which are essential for extending this to existentials.

Of course constraints could just be appended, e.g. `P & Q where ...` which might have to be enclosed in parenthesis in some situations.



-Thorsten



   * Is the problem being addressed significant enough to warrant a change to Swift?


Yes. Generalized existentials are very important for Swift and this is an enabler.



     * Does this proposal fit well with the feel and direction of Swift?


Yes.



     * If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?


Ceylon uses "&" as type operator for type intersections which is effectively the same as any<>, i.e. in Ceylon you would write `P & Q` instead of `any<P, Q>`.

The drawback there is that it might be more difficult to add constraints.




 * How much effort did you put into your review? A glance, a quick reading, or an in-depth study?


In depth study and participation in the discussion.


-Thorsten
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160525/64ee2aea/attachment.html>


More information about the swift-evolution mailing list