Right now it's more like "foo".write(to: &stream) but I agree that having to implement a custom stream is kind of irritating for stderr and stdout.
import Cocoa var str = "Hello, playground" struct StderrStream: OutputStream { static var shared = StderrStream() func write(_ string: String) { fputs(string, stderr) } } str.write(to: &StderrStream.shared) -- E > On Jul 8, 2016, at 4:41 PM, Saagar Jha via swift-evolution > <swift-evolution@swift.org> wrote: > > Currently, it’s rather annoying to print to standard error, requiring either > something low-level like fputs. I was wondering if a standardError > OutputStream could be added to the standard library, so we could write > something like print(“foo”, &standardError). > > -- > -Saagar Jha > _______________________________________________ > swift-evolution mailing list > swift-evolution@swift.org > https://lists.swift.org/mailman/listinfo/swift-evolution
_______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution