[swift-evolution] Addition of a standardError OutputStream

Zach Waldowski zach at waldowski.me
Mon Jul 11 15:08:12 CDT 2016


`Process` might be a good place for namespacing these. You'll also note
that `print` can take an OutputStream to make this even more idiomatic.
Straw man example at
https://gist.github.com/zwaldowski/4ed2fd48da2af3193b0cbd3ec1883c9d.
 
Cheers!
  Zachary Waldowski
  zach at waldowski.me
 
 
On Mon, Jul 11, 2016, at 12:24 PM, Erica Sadun via swift-evolution wrote:
> Just throwing this here. Unfortunately `Stream` is already taken (and
> tied to Foundation).
>
> public struct StdStream {
>  public struct StderrStream: OutputStream {
>  public func write(_ string: String) { fputs(string, Darwin.stderr) }
>     }
>
>  public struct StdoutStream: OutputStream {
>  public func write(_ string: String) { fputs(string, Darwin.stdout) }
>     }
>
>  public static var err = StderrStream()
>  public static var out = StdoutStream()
> }
>
> So in use, it would look something like
>
> str.write(to: &StdStream.out)
> str.write(to: &StdStream.err)
>
> I also considered DarwinStream (seemed too on the nose), UnixStream,
> Streamfd, BSDStream, etc. Didn't like any of them.
>
> -- E, have paintbrush will bikeshed
>
>
>> On Jul 11, 2016, at 12:58 PM, Saagar Jha via swift-evolution <swift-
>> evolution at swift.org> wrote:
>>
>> Thanks, I’ll write it up.
>>> On Jul 11, 2016, at 11:20, Dave Abrahams via swift-evolution <swift-
>>> evolution at swift.org> wrote:
>>>
>>>
>>> on Sun Jul 10 2016, Saagar Jha <swift-evolution at swift.org> wrote:
>>>
>>>> What is the process for smaller issues like these? I’m
>>>> guessing that
>>>> this doesn’t need a proposal; where should it go? On bugs.swift.org
>>>> <http://bugs.swift.org/>?
>>>
>>> If it adds an API, it needs a proposal.  Doesn't necessarily
>>> have to be
>>> a big proposal, and the review period can be short, but we don't add
>>> APIs without the evolution process.
>>>
>>> Thanks,
>>> Dave
>>>
>>> --
>>> Dave
>>>
>>> _______________________________________________
>>> swift-evolution mailing list
>>> swift-evolution at swift.org
>>> https://lists.swift.org/mailman/listinfo/swift-evolution
>>
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-evolution
> _________________________________________________
> 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/20160711/2d0ec1d0/attachment.html>


More information about the swift-evolution mailing list