Am 17. Mai 2016 um 08:55 schrieb Brent Royal-Gordon <[email protected]>: But don't you mean the union type of all possible Collection types when you write Any<Collection>? No, I mean "an existential capable of holding any Collection". I agree but I think this is just a generalization of type unions as they are currently possible in Ceylon. ´A | B´ in Ceylon notation (or any<A, B> in proposed Swift notation) is a union type meaning a type capable of holding an A or a B. Any<Collection> is a type capable of holding any Collection, i.e. something like `forall E. Collection where Element == E`. If I could enumerate all possible values for `E` then I could write this as an explicit type union (which would be very very long, of course :-) Something like: (Collection where Element == Int) | (Collection where Element == String) | ... If I write Any<Equatable, Collection>, I mean "an existential capable of holding any Equatable Collection". Which is a type union of Equatable and the existential representing any Collection. If I write Any<UITableViewCell, CounterDisplaying>, I mean "an existential capable of holding any CounterDisplaying UITableViewCell". Which would be written as type union `UITableViewCell | CounterDisplaying` in Ceylon. If I write Any<Collection where .Element: Equatable>, I mean "an existential capable of holding any Collection with an Equatable Element". If I write Any<class>, I mean "An existential capable of holding any class instance". If I write Any, I mean "An existential capable of holding anything". Union types have nothing to do with it. IMHO they are a just special case where I can write down all types forming the union explicitly whereas an existential uses a type variable which can assume all types (or all types of a constrained subset). Actually I like this generalization very much (although I think the type operators `|` and `&` are much easier to read than `Any<>` and `All<>` but they don't generalize to existentials). -Thorsten
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
