[swift-evolution] pitch: Unified libc import (again)

Greg Parker gparker at apple.com
Fri Aug 18 18:55:21 CDT 2017


> On Aug 17, 2017, at 5:16 PM, Xiaodi Wu via swift-evolution <swift-evolution at swift.org> wrote:
> 
> On Thu, Aug 17, 2017 at 6:46 PM, Taylor Swift <kelvin13ma at gmail.com <mailto:kelvin13ma at gmail.com>> wrote:
> I don’t think the “is this library functionality or standard library functionality” argument is worth having, but if stdout and stdin are first-class citizens in the Swift world, so should stderr.
> 
> As for bringing Foundation into the discussion, you can’t really talk about Foundation without also talking about the mountains of problems that come with the monolith pattern. But that’s a completely different conversation to be had.
> 
> I'm not sure what you're getting at here, but I don't believe you've addressed my question, which is: it's been firmly decided that I/O belongs in Foundation, and Foundation does in fact offer such facilities--what is missing from those facilities, and how can we fill it out?

Lots of I/O functionality is missing from Foundation. Foundation's design from time immemorial is that generally only relatively simple and high-level operations are available in Foundation itself, and if you want to do complicated or non-portable things then you are expected to drop down to POSIX or other C interfaces. That design works less well in Swift than it did in Objective-C because Swift's interface with C, especially low-level C, is often ugly.

Simple example: there is no way to access file information directly via NSFileHandle. You need to call NSFileHandle.fileDescriptor and pass that to  fstat() or fcntl(). The NSFileHandle API in general is sparse and wholly inadequate for sophisticated I/O.


-- 
Greg Parker     gparker at apple.com <mailto:gparker at apple.com>     Runtime Wrangler


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170818/d877f456/attachment.html>


More information about the swift-evolution mailing list