[swift-evolution] Proposal Idea : Library (third party) Importable Checking
Jacob Bandes-Storch
jtbandes at gmail.com
Thu Jan 14 22:59:53 CST 2016
This seems useful. Concrete syntax–wise, my first thought would be "import?
ThirdPartyLibrary".
On Thu, Jan 14, 2016 at 9:22 AM, Jo Albright via swift-evolution <
swift-evolution at swift.org> wrote:
> This is a thought from a current problem I am running into (and have ran
> into in the past).
>
> 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.
>
> Situation :
>
> 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.
>
> Possible Solution :
>
> 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.
>
> @importable ThirdPartyLibrary // would check if library is added to
> project and import it
>
> if #imported(ThirdPartyLibrary) {
>
>
> // would check if library is imported before source kit parses scope
>
> // if library is not imported
> // scope would remain unparsed
> // scope could be removed as if it were a comment
>
>
> }
>
> Thanks.
>
> Designer . Developer . Nerd
> Jo Albright
>
>
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160114/871b0f64/attachment.html>
More information about the swift-evolution
mailing list