<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">Am 11.12.2015 um 03:14 schrieb John McCall via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt;:</div><div class=""><div class=""><br class="">Right, sorry; I’ve gotten too used to the C++ sense. &nbsp;I mean types which contain free uses of the generic parameters of the context, which therefore appear to be opaque there. &nbsp;It’s a problem for union typing because the intersection of any opaque types with the other concrete types in a union is not necessarily empty. &nbsp;It’s not an unsolvable problem, of course.<br class=""></div></div></blockquote><div><br class=""></div>Do you mean something along these lines (taken from Ceylon)?</div><div><br class=""></div><div>&nbsp;<font face="Menlo" class="">interface&nbsp;Set&lt;These&gt; {<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>shared formal&nbsp;Set&lt;These&nbsp;|&nbsp;Those&gt; union&lt;Those&gt;(Set&lt;Those&gt; set);</font></div><div><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>shared formal Set&lt;These &amp; Those&gt; intersection&lt;Those&gt;(Set&lt;Those&gt; set);<br class="">}</font></div><div><font face="Menlo" class=""><br class=""></font></div><div><font face="Menlo" class="">Set&lt;Foo&gt; setOfFoo = ... ;<br class="">Set&lt;Bar&gt; setOfBar = ... ;<br class=""><br class="">Set&lt;Foo&nbsp;|&nbsp;Bar&gt; setUnion = setOfFoo.union(setOfBar); // each element conforms to Foo or Bar</font></div><div><font face="Menlo" class="">Set&lt;Foo &amp; Bar&gt; setIntersection = setOfFoo.intersection(setOfBar); // each element conforms to Foo and Bar</font></div><div><br class=""></div><div>Types like <font face="Menlo" class="">(Int | Int)</font> reduce to <font face="Menlo" class="">Int</font>, of course, etc.</div><div><br class=""></div><div>-Thorsten</div><div><br class=""></div></body></html>