<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Right now it's more like "foo".write(to: &stream) but I agree that having to implement</div><div class="">a custom stream is kind of irritating for stderr and stdout.</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; line-height: normal; font-family: Menlo; font-size: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">import</span><span style="font-variant-ligatures: no-common-ligatures" class=""> Cocoa</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 19px; font-size: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(209, 47, 27); font-size: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">var</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> str = </span><span style="font-variant-ligatures: no-common-ligatures" class="">"Hello, playground"</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 19px; font-size: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; line-height: normal; font-family: Menlo; font-size: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">struct</span><span style="font-variant-ligatures: no-common-ligatures" class=""> StderrStream: </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">OutputStream</span><span style="font-variant-ligatures: no-common-ligatures" class=""> {</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; font-size: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">static</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">var</span><span style="font-variant-ligatures: no-common-ligatures" class=""> shared = </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">StderrStream</span><span style="font-variant-ligatures: no-common-ligatures" class="">()</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; font-size: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">func</span><span style="font-variant-ligatures: no-common-ligatures" class=""> write(</span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">_</span><span style="font-variant-ligatures: no-common-ligatures" class=""> string: </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">String</span><span style="font-variant-ligatures: no-common-ligatures" class="">) { </span><span style="font-variant-ligatures: no-common-ligatures; color: #3d1d81" class="">fputs</span><span style="font-variant-ligatures: no-common-ligatures" class="">(string, </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">stderr</span><span style="font-variant-ligatures: no-common-ligatures" class="">) }</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; font-size: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">}</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 19px; font-size: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135); font-size: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">str</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #3d1d81" class="">write</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">(to: &</span><span style="font-variant-ligatures: no-common-ligatures" class="">StderrStream</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">.</span><span style="font-variant-ligatures: no-common-ligatures" class="">shared</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">)</span></div></div><div class=""><br class=""></div>-- E<div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jul 8, 2016, at 4:41 PM, Saagar Jha via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><p class="">Currently, it’s rather annoying to print to standard error, requiring either something low-level like <code class="">fputs</code>. I was wondering if a <code class="">standardError</code> <code class="">OutputStream</code> could be added to the standard library, so we could write something like <code class="">print(“foo”, &standardError)</code>.</p>
</div><div dir="ltr" class="">-- <br class=""></div><div data-smartmail="gmail_signature" class=""><div dir="ltr" class="">-Saagar Jha</div></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>