<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=""><div class="">I think an important point is that `all&lt;&gt;` should NOT be restricted to having only one reference or value type!</div><div class=""><br class=""></div><div class="">Ceylon does not have any restrictions like that. You can form the type intersection of String and Integer for example, which are both classes in Ceylon and because Ceylon like Swift only knows single inheritance between classes, the result is simply `Nothing` (the bottom type which has no elements). So there is no need to forbid this explicitly, because the types work out just fine.</div><div class=""><br class=""></div><div class="">Furthermore you can form type intersections between reference types which inherit from each other. The resulting intersection type is valid and is just equal to the more specific type. And of course you can form type intersections of a reference or value type with itself (i.e. all&lt;SomeClass, SomeClass&gt;).</div><div class=""><br class=""></div><div class="">Why should that be useful you may ask?</div><div class=""><br class=""></div><div class="">This generality is important when using intersection types with generics: let’s consider the type of a function forming the intersection of two sets with different element types:</div><div class=""><br class=""></div><div class="">func union&lt;T, U&gt;(a: Set&lt;T&gt;, b: Set&lt;U&gt;) -&gt; Set&lt;all&lt;T, U&gt;&gt; { … }</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Requiring all&lt;T,U&gt; to have at most one reference or value type (which must be at first position) would impose some unnecessary restrictions:</div><div class=""><br class=""></div><div class="">Given the following:</div><div class=""><br class=""></div><div class="">protocol Named {}</div><div class="">class Person : Named {}</div><div class="">class Employee : Person {}</div><div class=""><br class=""></div><div class="">let people: Set&lt;Person&gt;</div><div class="">let otherPeople: Set&lt;Person&gt;</div><div class="">let employees: Set&lt;Employee&gt;</div><div class="">let namedOnes: Set&lt;Named&gt;</div><div class=""><br class=""></div><div class="">// unnecessary restriction:</div><div class="">let x1 = union(namedOnes, people) &nbsp;// not allowed, because result type contains all&lt;Named, Person&gt;&nbsp;</div><div class=""><br class=""></div><div class="">// the restriction would require us to write:</div><div class="">let x2 = union(people, namedOnes) &nbsp;// ok, result type would be Set&lt;all&lt;Person, Named&gt;&gt; which would be simplified by the compiler to Set&lt;Named&gt; (Ceylon does this!)</div><div class=""><br class=""></div><div class="">// unnecessary restriction:</div><div class="">let x3 = union(people, employees) &nbsp; // not allowed, because result type would contain all&lt;Person, Employee&gt; with two reference types</div><div class=""><br class=""></div><div class="">// unnecessary restriction</div><div class="">let x4 = union(people,&nbsp;otherPeople) &nbsp; // not allowed, because result type contains all&lt;Person, Person&gt; with two reference types</div><div class=""><br class=""></div><div class="">IMO these should all be allowed (and are possible in Ceylon).&nbsp;</div><div class="">The result type of x1 would be Set&lt;all&lt;Named, Person&gt;&gt; which would be simplified by the compiler to Set&lt;Named&gt;.</div><div class="">The result type of x2 would be Set&lt;all&lt;Person, Named&gt;&gt; which would be simplified by the compiler to Set&lt;Named&gt;.</div><div class="">The result type of x3 would be Set&lt;all&lt;Person, Employee&gt;&gt; which would be simplified by the compiler to Set&lt;Employee&gt;.</div><div class="">The result type of x4 would be Set&lt;all&lt;Person, Person&gt;&gt; which would be simplified by the compiler to Set&lt;Person&gt;.</div><div class=""><br class=""></div><div class="">-Thorsten</div><div class=""><br class=""></div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">Am 14.05.2016 um 01:50 schrieb Adrian Zubarev via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt;:</div><br class="Apple-interchange-newline"><div class=""><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px;" class="">If anyone is interested, I started a draft proposal with detailed design here:&nbsp;<a href="https://github.com/DevAndArtist/swift-evolution/blob/master/proposals/nnnn-merging-types-with-protocols.md" class="">https://github.com/DevAndArtist/swift-evolution/blob/master/proposals/nnnn-merging-types-with-protocols.md</a></div><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px;" class=""><br class=""></div><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px;" class="">I didn’t post it here, because it is a bit huge and could lose its markdown formats. `all&lt;&gt;` is always bold, because this is what we are interested in, but I provided all possible combinations if the other formats would exists (at least all combinations I could think of, anything else is derived from these).&nbsp;</div><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px;" class=""><br class=""></div><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px;" class="">`class&lt;&gt;` etc. can be seen as a future direction (I would say), otherwise this would easily become out of scope for Swift 3. (I will &nbsp;move `class&lt;&gt;` etc. from detailed design to future direction later.)</div><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px;" class=""><br class=""></div><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px;" class="">I’d love to hear your feedback and strong arguments for the motivation part I could include into this proposal.</div><br style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div id="bloop_sign_1463182837742214912" class="bloop_sign" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div style="font-family: helvetica, arial; font-size: 13px;" class="">--&nbsp;<br class="">Adrian Zubarev<br class="">Sent with Airmail</div></div><br style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><p class="airmail_on" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Am 13. Mai 2016 bei 23:16:20, Vladimir.S (<a href="mailto:svabox@gmail.com" class="">svabox@gmail.com</a>) schrieb:</p><blockquote type="cite" class="clean_bq" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span class=""><div class=""><div class=""></div><div class="">You asked for any example, I give it to you ;-)<span class="Apple-converted-space">&nbsp;</span><br class="">(as I said, it is syntactical, just to show that such struct&lt;&gt; can be used<span class="Apple-converted-space">&nbsp;</span><span class="Apple-converted-space">&nbsp;</span><br class="">to test some struct for conforming to protocol, that was not conformed at<span class="Apple-converted-space">&nbsp;</span><span class="Apple-converted-space">&nbsp;</span><br class="">writing time)<span class="Apple-converted-space">&nbsp;</span><br class="">Probably we can invent useful examples for this struct&lt;&gt; - but I don't<span class="Apple-converted-space">&nbsp;</span><span class="Apple-converted-space">&nbsp;</span><br class="">believe it will be introduced in Swift ;-)<span class="Apple-converted-space">&nbsp;</span><br class=""><br class="">On 13.05.2016 22:14, Adrian Zubarev via swift-evolution wrote:<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; Can we really do that? I mean, I thought about that myself but I came to<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; the conclusion that this scenario is like: I was to lazy to couple this<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; structs to my library protocols, will you do that for me?<span class="Apple-converted-space">&nbsp;</span><br class=""></div></div></span></blockquote><span style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">swift-evolution mailing list</span><br style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a></span><br style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span></div></blockquote></div><br class=""></body></html>