<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="">I disagree. What about when you need to disambiguate?<div class=""><br class=""></div><div class="">Currently you’d need to use ‘Darwin.connect(...)’ or ‘Glibc.connect(…)’. Merging them both in to one ‘Libc’ module would make that much easier.</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 18 Oct 2016, at 01:07, Sean Alling via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div dir="auto" class=""><div class="">Yeah I saw that thread. I think (a) this is a better solution and (b) this is applicable for use cases other than specifically Glibc/Darwin.</div><div class=""><br class=""></div><div class="">-Sean<br class=""><br class="">Sent from my iPhone</div><div class=""><br class="">On Oct 17, 2016, at 19:01, Saagar Jha &lt;<a href="mailto:saagar@saagarjha.com" class="">saagar@saagarjha.com</a>&gt; wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><div dir="ltr" class="">I believe there was a draft to merge all the "Libc" modules; let me see if I can find that.</div><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Mon, Oct 17, 2016 at 3:06 PM Sean Alling via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><u class="gmail_msg"><b class="gmail_msg">Description</b></u></div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">In an effort to both (1) reduce boilerplate code, and (2) promote cross-platform reusability I propose that we implement the following&nbsp;<b class="gmail_msg">Import Conditional Operators</b>:&nbsp;</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><b class="gmail_msg">`||`&nbsp;</b>and `<b class="gmail_msg">&amp;&amp;`</b></div><div class="gmail_msg"><b class="gmail_msg"><br class="gmail_msg"></b></div><div class="gmail_msg">Currently, import conditionals must be implemented like so:</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">```</div><div class="gmail_msg">#if os(Linux) || os(FreeBSD)<br class="gmail_msg"><span class="gmail_msg m_4870885646406276582Apple-tab-span" style="white-space:pre-wrap">        </span>import Glibc<br class="gmail_msg">#else<br class="gmail_msg"><span class="gmail_msg m_4870885646406276582Apple-tab-span" style="white-space:pre-wrap">        </span>import Darwin<br class="gmail_msg">#endif</div><div class="gmail_msg">```</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">With <b class="gmail_msg">import&nbsp;conditional operators</b>&nbsp;this would be condensed to:</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">```</div><div class="gmail_msg">import Glibc || Darwin</div><div class="gmail_msg">```</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">The first library/framework (Glibc) would be imported if found and the the second (Darwin) only in the event the first should fail.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><b class="gmail_msg"><u class="gmail_msg">Other Caveats:</u></b></div><div class="gmail_msg"><b class="gmail_msg"><u class="gmail_msg"><br class="gmail_msg"></u></b></div><div class="gmail_msg"><b class="gmail_msg">(A) — &nbsp;</b>we could limit this to one conditional operator per import line OR we could implement order of operations. Obviously, there are tradeoffs of both that we should discuss.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><b class="gmail_msg">(B) —</b>&nbsp;if-conditional statements currently explicitly show the import conditions (i.e., os(Linux) || os(FreeBSD)) this would be a detriment to this new feature. I would argue that the reduction of boilerplate code would in itself be worth this abstraction.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">--</div><div class="gmail_msg">Sean Alling</div><div class="gmail_msg"><br class="gmail_msg"></div></div>_______________________________________________<br class="gmail_msg">
swift-evolution mailing list<br class="gmail_msg">
<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="gmail_msg">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="gmail_msg">
</blockquote></div>
</div></blockquote></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></div></body></html>