[swift-evolution] Enhanced existential types proposal discussion
Thorsten Seitz
tseitz42 at icloud.com
Fri May 20 05:18:10 CDT 2016
> Am 18.05.2016 um 23:17 schrieb Austin Zheng via swift-evolution <swift-evolution at swift.org>:
>
> The order does not affect the semantic meaning of the existential. There is a section in the proposal on how existentials are conceptually 'reduced' from whatever form they take when the programmer types them in, please read it. I am not proposing a macro system. The compiler does not do textual replacement in order to flatten nested existential definitions.
>
> This is also why it makes no sense to have a generic "Any<T, U>", because such a type is identical to "Any<U, T>", which is not true for any other generic type or aggregate type in Swift.
Shouldn’t that be a reason to use `any<>` (using a keyword `any`) instead of `Any<>`? Because `Any<>` would just look like/be a generic type with all normal expectations, e.g. `Any<T, U>` would *not* be equal to `Any<U, T>` which is different behavior from `protocol<>`, as I can write
func foo(p: protocol<A, B>) -> protocol<B, A> {
return p
}
-Thorsten
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160520/066049fd/attachment.html>
More information about the swift-evolution
mailing list