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

Brent Royal-Gordon brent at architechies.com
Thu Oct 6 00:16:07 CDT 2016


> On Oct 5, 2016, at 8:55 PM, Xiaodi Wu <xiaodi.wu at gmail.com> wrote:
> 
> 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?

The difference I imagine between `Platform` and `CPlatform` is that `Platform` would do things like:

* Convert `errno`-setting functions to throwing functions.
* Convert many returns by pointer parameter into tuple returns.
* Encapsulate certain structures, like `FILE` and `sockaddr`, which are really awkward to use in Swift.
* Organize free-floating constants into enums.
* Possibly move some operations from free functions to methods.

Whereas `CPlatform` would be basically a straight import of the C libraries, warts and all.

I don't actually imagine that `Platform` would do much platform abstraction except in trivial cases, like the ones currently in stdlib/public/Platform/Misc.c.

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list