[swift-evolution] [Draft] Unify "import Darwin/Glibc" to simply "Libc"
Tyler Cloutier
cloutiertyler at aol.com
Wed Oct 5 16:54:07 CDT 2016
There is also a similar intent for Zewo’s POSIX:
https://github.com/Zewo/POSIX/blob/master/Sources/POSIX
It would be great to have something included with Swift.
> On Sep 14, 2016, at 5:59 AM, Alex Blewitt via swift-evolution <swift-evolution at swift.org> wrote:
>
> Vapor's Core package expresses a target called simply 'libc':
>
> https://github.com/vapor/core/blob/master/Sources/libc/libc.swift <https://github.com/vapor/core/blob/master/Sources/libc/libc.swift>
>
> As a result, their Swift files simply say "import libc"
>
> https://github.com/vapor/core/blob/master/Sources/Core/Lock.swift <https://github.com/vapor/core/blob/master/Sources/Core/Lock.swift>
>
> Alex
>
>> On 13 Sep 2016, at 20:29, Brian Gesiak via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>>
>> 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 <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
>>
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
>> https://lists.swift.org/mailman/listinfo/swift-evolution
>
> _______________________________________________
> 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/20161005/8b1b9347/attachment.html>
More information about the swift-evolution
mailing list