Vapor's Core package expresses a target called simply 'libc':
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
Alex
···
On 13 Sep 2016, at 20:29, Brian Gesiak via swift-evolution <swift-evolution@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
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
#endifInto 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@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution