[swift-users] Pure Swift, cross platform way to open, read/write files?

Chris Lattner clattner at apple.com
Tue Dec 8 23:09:33 CST 2015


> On Dec 8, 2015, at 8:55 PM, Brent Royal-Gordon via swift-users <swift-users at swift.org> wrote:
> 
>> But at the same time I get your point just use #if #else #endif to conditional import / call functions... but coding like that doesn't seem vary fun... reminds me of looking a C code that was meant to be compiled on different processor architectures. :-( 
> 
> I would really like to see Swift offer a “POSIX” or “LibC” module which would import whatever the current platform offered for a C library. Obviously there would be differences between Glibc and Darwin.C, and I wouldn’t expect Swift to try to paper those over, but this `#if os` dance in every file is kind of ridiculous.

+1

-Chris


More information about the swift-users mailing list