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

Xiaodi Wu xiaodi.wu at gmail.com
Wed Oct 5 22:55:57 CDT 2016

On Wed, Oct 5, 2016 at 10:47 PM, Brent Royal-Gordon via swift-evolution <
swift-evolution at swift.org> wrote:

> > On Oct 5, 2016, at 7:08 PM, Greg Parker <gparker at apple.com> wrote:
> >
> >> Now, as for naming: I like using the leading "C" convention ("CLibc")
> because it leaves us room for introducing an overlaid version of the module
> in the future without breaking source compatibility. Because of this, I
> wouldn't want to name the module just `C`, because it wouldn't leave room
> for a Swifty version later.
> >
> > I don't think separating the raw C library translation from the pretty
> Swift wrapper works, at least not for everybody. The problem is that the
> raw translation is going to have functions that the pretty wrapper does
> not. (Perhaps the pretty wrapper is new and incomplete. Perhaps an OS has
> added functions and the pretty wrapper has not caught up yet.)  If you try
> to import both then you end up with the same problems of name collisions
> today and source incompatibility in the future when the pretty wrapper
> grows.
> I didn't mean that you could import both—merely that, if you used CLibc
> (or CPlatform) today, the introduction of the pretty Libc or Platform in a
> future version of Swift wouldn't affect your existing code.
> As for handing unsupported features, I'd like you to be able to say
> something like (using a version of today's syntax):
>         import Platform
>         import func CPlatform.newfunc(_:_:)
> Which would hopefully mean that, if a future version of Libc added
> newfunc(_:_:), the CLibc version—which is the one we explicitly
> requested—would shadow it. (Perhaps when you rebuilt against the newer
> version of Libc, you'd get a shadowing warning that would hint to you that
> you don't need to pull that function in from CLibc anymore.)

See, I'd assumed that the "unified" Darwin/Glibc would simply be what you
call Platform. And if we're going to have that overlay, what's the point of
also renaming Darwin/Glibc to CPlatform, given that it's going to be
different between platforms, and given that what's not going to be in the
Platform overlay is much more likely to be the divergent bits?

> --
> Brent Royal-Gordon
> Architechies
> _______________________________________________
> 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/fd940ddb/attachment.html>

More information about the swift-evolution mailing list