[swift-evolution] [Draft] Unify "import Darwin/Glibc" to simply "Libc"

Brian Gesiak modocache at gmail.com
Tue Sep 13 14:29:23 CDT 2016


Resurrecting this discussion since the question of "why does Android import
Glibc?" came up on this swift-corelibs-foundation pull request:
https://github.com/apple/swift-corelibs-foundation/pull/622#discussion_r77848100

I think that it is also important to ask what the real goal here is.
> Foundation is our cross platform compatibility layer, are there specific
> deficiencies in the Foundation API that cause a problem here, or is it just
> that not all of corelibs Foundation is “done” yet?
>

When I first proposed the idea, I simply wanted to turn these five lines:

    #if os(Linux) || os(FreeBSD) || os(Android) || os(PS4)
        import Glibc
    #else
        import Darwin
    #endif

Into this one line:

    import WhateverNameWeDecideUpon

After all, writing five lines of code for the import is painful, and the
list of `#if os(...) || os(...) || ...` is always expanding.

I hadn't thought about a unified overlay for POSIX. I think the simplified
import alone has benefit to warrant its own evolution proposal. Would it be
possible to have a separate discussion for the POSIX overlay idea? Or is
there a reason that I'm missing that prevents the import from being viable
on its own? (Apologies in advance if there's an obvious answer to this
question!)

- Brian Gesiak
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160913/396feb5f/attachment.html>


More information about the swift-evolution mailing list