<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Just thought I’d link the previous thread on this topic:&nbsp;<a href="https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160704/023927.html" class="">https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160704/023927.html</a>.&nbsp;I had promised to write a proposal for it back then, but never got around to doing it. Now that we’re out of the hectic Swift 3 timeframe, I can write a proposal and implementation for this, since it’s more likely to be accepted.<div class=""><br class=""></div><div class="">More broadly, however, I think a “Swiftication” of POSIX or libc is extremely necessary for anyone who’s not working with Foundation–and not everyone is! There are still parts of POSIX that are either 1. not a part of Foundation or 2. part of Foundation/CoreFoundation but not in the open source Swift Foundation or CFLite (and hence not available on Linux). A big part of attracting newer Swift developers a moving away from the “Swift is for apps only” and the in my experience the need to drop down to UnsafePointer or errno just to use this API has been a big turn-off for programmers.</div><div class=""><br class=""><div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Saagar Jha</div>

</div>
<div><br class=""><blockquote type="cite" class=""><div class="">On Aug 18, 2017, at 04:17, Xiaodi Wu via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class="">Not “fundamentally” incompatible:<br class=""><br class="">var stderr = FileHandle.standardError<br class="">/* Conform FileHandle to TextOutputStream */<br class="">print("foo", to: &amp;stderr)<br class=""><br class=""><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Fri, Aug 18, 2017 at 01:39 Brent Royal-Gordon &lt;<a href="mailto:brent@architechies.com" class="">brent@architechies.com</a>&gt; wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class=""><blockquote type="cite" class=""><div class="">On Aug 17, 2017, at 8:20 PM, Xiaodi Wu via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="m_814963807829650536Apple-interchange-newline"><div class=""><blockquote class="gmail_quote" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class="">*<span class="m_814963807829650536Apple-converted-space">&nbsp;</span><span style="font-family:monospace,monospace" class="">stderr</span><span class="m_814963807829650536Apple-converted-space">&nbsp;</span>should go wherever<span class="m_814963807829650536Apple-converted-space">&nbsp;</span><span style="font-family:monospace,monospace" class="">stdin</span><span class="m_814963807829650536Apple-converted-space">&nbsp;</span>and<span class="m_814963807829650536Apple-converted-space">&nbsp;</span><span style="font-family:monospace,monospace" class="">stdout</span><span class="m_814963807829650536Apple-converted-space">&nbsp;</span>go. Since it’d be silly for a function like `<span style="font-family:monospace,monospace" class="">print(_:separator:terminator:)</span>` or `<span style="font-family:monospace,monospace" class="">readLine(strippingNewline:)</span>` to live anywhere but the standard library, then it stands to reason that the<span class="m_814963807829650536Apple-converted-space">&nbsp;</span><span style="font-family:monospace,monospace" class="">stderr</span><span class="m_814963807829650536Apple-converted-space">&nbsp;</span>version should also live in the standard library.<br class=""></div></div></div></div></div></div></div></div></div></div></div></blockquote><div dir="auto" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><br class=""></div><div dir="auto" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="">FWIW, FileHandle.standardInput, FileHandle.standardError, FileHandle.standardOutput, and FileHandle.nullDevice all live in Foundation.</div></div></blockquote><br class=""></div></div><div style="word-wrap:break-word" class=""><div class="">And, since they're read-only, are fundamentally incompatible with `print(…to:)`, which requires its `output` parameter to be passed `inout`.</div></div><div style="word-wrap:break-word" class=""><br class=""><div class="">
<span class="m_814963807829650536Apple-style-span" style="border-collapse:separate;font-variant-ligatures:normal;font-variant-east-asian:normal;line-height:normal;border-spacing:0px"><div class=""><div style="font-size:12px" class="">--&nbsp;</div><div style="font-size:12px" class="">Brent Royal-Gordon</div><div style="font-size:12px" class="">Architechies</div></div></span>

</div>
<br class=""></div></blockquote></div>
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></div></body></html>