<html><body><div><br></div><div><br>Am 17. Mai 2016 um 08:55 schrieb Brent Royal-Gordon &lt;brent@architechies.com&gt;:<br><br><div><blockquote type="cite"><div class="msg-quote"><div class="_stretch"><span class="body-text-content"><blockquote type="cite" class="quoted-plain-text">But don't you mean the union type of all possible Collection types when you write Any&lt;Collection&gt;?</blockquote><br>No, I mean "an existential capable of holding any Collection".</span></div></div></blockquote></div><div><span><br data-mce-bogus="1"></span></div><div><span>I agree but I think this is just a generalization of type unions as they are currently possible in Ceylon.<br data-mce-bogus="1"></span></div><div><span><br data-mce-bogus="1"></span></div><div><span>´A | B´ in Ceylon notation (or any&lt;A, B&gt; in proposed Swift notation) is a union type meaning a type capable of holding an A or a B.</span></div><div><span>Any&lt;Collection&gt; 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 :-)<br data-mce-bogus="1"></span></div><div><span>Something like: (Collection where Element == Int) | (Collection where Element == String) | ...<br data-mce-bogus="1"></span></div><div><span> <br></span><blockquote type="cite"><div class="msg-quote"><div class="_stretch"><span class="body-text-content"><br><br>If I write Any&lt;Equatable, Collection&gt;, I mean "an existential capable of holding any Equatable Collection".</span></div></div></blockquote></div><div><span><br data-mce-bogus="1"></span></div><div><span>Which is a type union of Equatable and the existential representing any Collection.</span></div><div><span> <br></span><blockquote type="cite"><div class="msg-quote"><div class="_stretch"><span class="body-text-content"><br><br>If I write Any&lt;UITableViewCell, CounterDisplaying&gt;, I mean "an existential capable of holding any CounterDisplaying UITableViewCell".</span></div></div></blockquote></div><div><span><br data-mce-bogus="1"></span></div><div><span>Which would be written as type union `<span class="body-text-content">UITableViewCell</span> | <span class="body-text-content">CounterDisplaying</span>` in Ceylon.</span></div><div><span><br></span><blockquote type="cite"><div class="msg-quote"><div class="_stretch"><span class="body-text-content"><br>If I write Any&lt;Collection where .Element: Equatable&gt;, I mean "an existential capable of holding any Collection with an Equatable Element".<br><br>If I write Any&lt;class&gt;, I mean "An existential capable of holding any class instance".<br><br>If I write Any, I mean "An existential capable of holding anything".<br><br>Union types have nothing to do with it.</span></div></div></blockquote></div><div><span><br data-mce-bogus="1"></span></div><div><span>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).</span></div><div><span><br data-mce-bogus="1"></span></div><div><span>Actually I like this generalization very much (although I think the type operators `|` and `&amp;` are much easier to read than `Any&lt;&gt;` and `All&lt;&gt;` but they don't generalize to existentials).<br data-mce-bogus="1"></span></div><div><span><br data-mce-bogus="1"></span></div><div><span>-Thorsten</span><div class="msg-quote"><div class="_stretch"><span class="body-text-content"><br></span></div></div></div></div></body></html>