<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 <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>>:</div><div class=""><div class=""><br class="">Right, sorry; I’ve gotten too used to the C++ sense. I mean types which contain free uses of the generic parameters of the context, which therefore appear to be opaque there. 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. 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> <font face="Menlo" class="">interface Set<These> {<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>shared formal Set<These | Those> union<Those>(Set<Those> set);</font></div><div><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>shared formal Set<These & Those> intersection<Those>(Set<Those> set);<br class="">}</font></div><div><font face="Menlo" class=""><br class=""></font></div><div><font face="Menlo" class="">Set<Foo> setOfFoo = ... ;<br class="">Set<Bar> setOfBar = ... ;<br class=""><br class="">Set<Foo | Bar> setUnion = setOfFoo.union(setOfBar); // each element conforms to Foo or Bar</font></div><div><font face="Menlo" class="">Set<Foo & Bar> 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>