<div dir="ltr">You&#39;re right. It&#39;s at least tricky, if not currently impossible. I take it back then.<div><br></div><div>I&#39;d be happy with a `StandardStream` type (though I&#39;d advocate, in the spirit of Swiftiness, to have it spelled out), with static `output` and `error`. This might be one of those rare cases where a reference type might be most appropriate, though, with perhaps a singleton design?</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 11, 2016 at 2:30 PM, Erica Sadun <span dir="ltr">&lt;<a href="mailto:erica@ericasadun.com" target="_blank">erica@ericasadun.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><blockquote type="cite"><div>On Jul 11, 2016, at 1:29 PM, Xiaodi Wu &lt;<a href="mailto:xiaodi.wu@gmail.com" target="_blank">xiaodi.wu@gmail.com</a>&gt; wrote:</div><br><div>Why not just OutputStream.stderr?<br></div></blockquote><div><br></div>Can you do an extension like that with state for a protocol?</div><span><font color="#888888"><div><br></div><div>-- E</div></font></span><span><div><br></div><div><br><blockquote type="cite"><div><br><div class="gmail_quote"><div dir="ltr">On Mon, Jul 11, 2016 at 14:25 Erica Sadun via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:<br></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">Just throwing this here. Unfortunately `Stream` is already taken (and tied to Foundation).<div><br></div><div><div style="margin:0px;font-size:16px;line-height:normal;font-family:Menlo"><div style="margin:0px;line-height:normal"><span style="color:#bb2ca2">public</span><span> </span><span style="color:#bb2ca2">struct</span><span> StdStream {</span></div><div style="margin:0px;line-height:normal"><span>    </span><span style="color:#bb2ca2">public</span><span> </span><span style="color:#bb2ca2">struct</span><span> StderrStream: </span><span style="color:#703daa">OutputStream</span><span> {</span></div><div style="margin:0px;line-height:normal"><span>        </span><span style="color:#bb2ca2">public</span><span> </span><span style="color:#bb2ca2">func</span><span> write(</span><span style="color:#bb2ca2">_</span><span> string: </span><span style="color:#703daa">String</span><span>) { </span><span style="color:#3d1d81">fputs</span><span>(string, Darwin.</span><span style="color:#703daa">stderr</span><span>) }</span></div><div style="margin:0px;line-height:normal"><span>    }</span></div><div style="margin:0px;line-height:normal;min-height:19px"><span>    </span><br></div><div style="margin:0px;line-height:normal"><span>    </span><span style="color:#bb2ca2">public</span><span> </span><span style="color:#bb2ca2">struct</span><span> StdoutStream: </span><span style="color:#703daa">OutputStream</span><span> {</span></div><div style="margin:0px;line-height:normal"><span>        </span><span style="color:#bb2ca2">public</span><span> </span><span style="color:#bb2ca2">func</span><span> write(</span><span style="color:#bb2ca2">_</span><span> string: </span><span style="color:#703daa">String</span><span>) { </span><span style="color:#3d1d81">fputs</span><span>(string, Darwin.</span><span style="color:#703daa">stdout</span><span>) }</span></div><div style="margin:0px;line-height:normal"><span>    }</span></div><div style="margin:0px;line-height:normal;min-height:19px"><span>    </span><br></div><div style="margin:0px;line-height:normal"><span>    </span><span style="color:#bb2ca2">public</span><span> </span><span style="color:#bb2ca2">static</span><span> </span><span style="color:#bb2ca2">var</span><span> err = </span><span style="color:#4f8187">StderrStream</span><span>()</span></div><div style="margin:0px;line-height:normal"><span>    </span><span style="color:#bb2ca2">public</span><span> </span><span style="color:#bb2ca2">static</span><span> </span><span style="color:#bb2ca2">var</span><span> out = </span><span style="color:#4f8187">StdoutStream</span><span>()</span></div><div style="margin:0px;line-height:normal"><span>}</span></div></div><div style="margin:0px;font-size:16px;line-height:normal;font-family:Menlo"><br></div><div>So in use, it would look something like </div><div><br></div><div><div style="margin:0px;font-size:16px;line-height:normal;font-family:Menlo"><div style="margin:0px;line-height:normal;color:rgb(79,129,135)"><span>str</span><span>.</span><span style="color:#3d1d81">write</span><span>(to: &amp;</span><span>StdStream</span><span>.</span><span>out</span><span>)</span></div><div style="margin:0px;line-height:normal;color:rgb(79,129,135)"><span>str</span><span>.</span><span style="color:#3d1d81">write</span><span>(to: &amp;</span><span>StdStream</span><span>.</span><span>err</span><span>)</span></div><div><span><br></span></div></div></div><div>I also considered DarwinStream (seemed too on the nose), UnixStream, Streamfd, BSDStream, etc. Didn&#39;t like any of them.</div><div><br></div><div>-- E, have paintbrush will bikeshed</div></div></div></blockquote></div></div></blockquote></div><br></span></div></blockquote></div><br></div></div>