<div dir="ltr">This seems useful. Concrete syntax–wise, my first thought would be &quot;import? ThirdPartyLibrary&quot;.<div class="gmail_extra">
<br><div class="gmail_quote">On Thu, Jan 14, 2016 at 9:22 AM, Jo Albright via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">This is a thought from a current problem I am running into (and have ran into in the past).<div><br></div><div>If you want to write any code using a library, you must have that library imported into the file. Totally cool with this for most cases.</div><div><br></div><div>Situation :</div><div><br></div><div>Building a third party library that can be used by others to simplify working with server APIs. I want to give the developer an option to use another third party library within mine. However, I don’t want my library to depend on the other library.</div><div><br></div><div>Possible Solution :</div><div><br></div><div>Add a system that does two things. 1) Checks for a library and if found imports it into file. 2) Checks if library is imported and allows source kit to parse conditional scope.</div><div><br></div><div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)"><span style="color:#bb2ca2">@importable</span><span style="color:#000000"> ThirdPartyLibrary </span>// would check if library is added to project and import it</div></div><div><br></div><div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(120,73,42)"><span style="color:#bb2ca2">if</span><span style="color:#000000"> </span>#imported<span style="color:#000000">(</span><span style="color:rgb(0,0,0)">ThirdPartyLibrary</span><span style="color:#000000">) {</span></div><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px">    <br></p><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)"><span style="color:#000000">    </span>// would check if library is imported before source kit parses scope</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)">    </div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)">    // if library is not imported</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)"><span style="color:#000000">    </span>// scope would remain unparsed</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)"><span style="color:#000000">    </span>// scope could be removed as if it were a comment</div><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px">    <br></p><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">}</div></div><div><br></div><div>Thanks.<br><div>
<div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word"><br><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important"><font color="#8d8d8d">Designer . Developer .  Nerd </font></span><font color="#464646"><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">Jo Albright</span></font><br style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"></div>
</div>
<br></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=P-2BsYbBZHRBuLDBJaL4DIKDNfkkjpROowTyRAObV11qyErUPXrr8-2F5XyV1iI3Dvp9pkGJ2yEPL06I4pVKNY5FPtr6ADwork0YzEN3InXWqgDyh3Acd4xJayb4sPLCDejGVJDePxeoEMNXNG1mXKjJpujIPARXz5iECyRtq93mzxkoT3NUXRLuPkylulFfKHMpTQI3dss7OotEioDS4L4gfM5lJxre0fZ-2BBdv5jLioROo-3D" alt="" width="1" height="1" border="0" style="min-height:1px!important;width:1px!important;border-width:0!important;margin-top:0!important;margin-bottom:0!important;margin-right:0!important;margin-left:0!important;padding-top:0!important;padding-bottom:0!important;padding-right:0!important;padding-left:0!important">
</div>
<br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div></div>