<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jul 11, 2016, at 1:29 PM, Xiaodi Wu <<a href="mailto:xiaodi.wu@gmail.com" class="">xiaodi.wu@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">Why not just OutputStream.stderr?<br class=""></div></blockquote><div><br class=""></div>Can you do an extension like that with state for a protocol?</div><div><br class=""></div><div>-- E</div><div><br class=""></div><div><br class=""><blockquote type="cite" class=""><div class=""><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Mon, Jul 11, 2016 at 14:25 Erica Sadun via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> 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="">Just throwing this here. Unfortunately `Stream` is already taken (and tied to Foundation).<div class=""><br class=""></div><div class=""><div style="margin:0px;font-size:16px;line-height:normal;font-family:Menlo" class=""><div style="margin:0px;line-height:normal" class=""><span style="color:#bb2ca2" class="">public</span><span class=""> </span><span style="color:#bb2ca2" class="">struct</span><span class=""> StdStream {</span></div><div style="margin:0px;line-height:normal" class=""><span class=""> </span><span style="color:#bb2ca2" class="">public</span><span class=""> </span><span style="color:#bb2ca2" class="">struct</span><span class=""> StderrStream: </span><span style="color:#703daa" class="">OutputStream</span><span class=""> {</span></div><div style="margin:0px;line-height:normal" class=""><span class=""> </span><span style="color:#bb2ca2" class="">public</span><span class=""> </span><span style="color:#bb2ca2" class="">func</span><span class=""> write(</span><span style="color:#bb2ca2" class="">_</span><span class=""> string: </span><span style="color:#703daa" class="">String</span><span class="">) { </span><span style="color:#3d1d81" class="">fputs</span><span class="">(string, Darwin.</span><span style="color:#703daa" class="">stderr</span><span class="">) }</span></div><div style="margin:0px;line-height:normal" class=""><span class=""> }</span></div><div style="margin: 0px; line-height: normal; min-height: 19px;" class=""><span class=""> </span><br class=""></div><div style="margin:0px;line-height:normal" class=""><span class=""> </span><span style="color:#bb2ca2" class="">public</span><span class=""> </span><span style="color:#bb2ca2" class="">struct</span><span class=""> StdoutStream: </span><span style="color:#703daa" class="">OutputStream</span><span class=""> {</span></div><div style="margin:0px;line-height:normal" class=""><span class=""> </span><span style="color:#bb2ca2" class="">public</span><span class=""> </span><span style="color:#bb2ca2" class="">func</span><span class=""> write(</span><span style="color:#bb2ca2" class="">_</span><span class=""> string: </span><span style="color:#703daa" class="">String</span><span class="">) { </span><span style="color:#3d1d81" class="">fputs</span><span class="">(string, Darwin.</span><span style="color:#703daa" class="">stdout</span><span class="">) }</span></div><div style="margin:0px;line-height:normal" class=""><span class=""> }</span></div><div style="margin: 0px; line-height: normal; min-height: 19px;" class=""><span class=""> </span><br class=""></div><div style="margin:0px;line-height:normal" class=""><span class=""> </span><span style="color:#bb2ca2" class="">public</span><span class=""> </span><span style="color:#bb2ca2" class="">static</span><span class=""> </span><span style="color:#bb2ca2" class="">var</span><span class=""> err = </span><span style="color:#4f8187" class="">StderrStream</span><span class="">()</span></div><div style="margin:0px;line-height:normal" class=""><span class=""> </span><span style="color:#bb2ca2" class="">public</span><span class=""> </span><span style="color:#bb2ca2" class="">static</span><span class=""> </span><span style="color:#bb2ca2" class="">var</span><span class=""> out = </span><span style="color:#4f8187" class="">StdoutStream</span><span class="">()</span></div><div style="margin:0px;line-height:normal" class=""><span class="">}</span></div></div><div style="margin:0px;font-size:16px;line-height:normal;font-family:Menlo" class=""><br class=""></div><div class="">So in use, it would look something like </div><div class=""><br class=""></div><div class=""><div style="margin:0px;font-size:16px;line-height:normal;font-family:Menlo" class=""><div style="margin:0px;line-height:normal;color:rgb(79,129,135)" class=""><span class="">str</span><span style="" class="">.</span><span style="color:#3d1d81" class="">write</span><span style="" class="">(to: &</span><span class="">StdStream</span><span style="" class="">.</span><span class="">out</span><span style="" class="">)</span></div><div style="margin:0px;line-height:normal;color:rgb(79,129,135)" class=""><span class="">str</span><span style="" class="">.</span><span style="color:#3d1d81" class="">write</span><span style="" class="">(to: &</span><span class="">StdStream</span><span style="" class="">.</span><span class="">err</span><span style="" class="">)</span></div><div class=""><span style="" class=""><br class=""></span></div></div></div><div class="">I also considered DarwinStream (seemed too on the nose), UnixStream, Streamfd, BSDStream, etc. Didn't like any of them.</div><div class=""><br class=""></div><div class="">-- E, have paintbrush will bikeshed</div></div></div></blockquote></div></div></blockquote></div><br class=""></body></html>