<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="">On Feb 28, 2017, at 2:00 PM, David Hart <<a href="mailto:david@hartbit.com" class="">david@hartbit.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 28 Feb 2017, at 22:39, Douglas Gregor via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Feb 27, 2017, at 11:21 PM, Nicolas Fezans via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">+1<div class="">I would also welcome to be able to use "or" and "and" logical operators (not only the not operator) on these constraints.</div></div></div></blockquote><div class=""><br class=""></div><div class="">You already have “and’ constraints: it’s what you get out of the comma-separated list of constraints in a where clause, or the “&” composition syntax.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="">I have sometimes generic functions whose code is identical but is written twice: first with 'where T=P1' and then with 'where T=P2', being able to write for instance 'where T=(P1 or P2)' would be very handy IMO.</div><div class="">One could often argue that additional protocols and extensions could be defined as a workaround to the situation I just mentioned but it seems often a bit of an overkill to me when you only have a couple of functions with that combination of requirements.</div></div></div></blockquote><div class=""><br class=""></div><div class="">“Or” constraints are a nonstarter for me, because you can’t meaningfully type-check a generic function that uses “or” constraints: the problem goes exponential in the number of “or” constraints and the meaning of the function can change considerably depending on which set of terms are satisfied—in which case you have ambiguities again!</div><div class=""><br class=""></div><div class="">Whenever this topic comes up, I like to point people at:</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2161.pdf" class="">http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2161.pdf</a></div></div></div></div></blockquote><div class=""><br class=""></div><div class="">Should we also follow Recommendation #2 and revert the <b class="">P1 & P2</b> change to return to <b class="">Any<P1, P2></b> :) Half-joking.</div></div></div></div></blockquote></div><br class=""><div class="">That line of argument got thoroughly shot down in the core team meeting when we discussed the introduction of the & operator for types.</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>- Doug</div><div class=""><br class=""></div></body></html>