https://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112015-06-05T22:48:55ZRuby Issue Tracking SystemRuby master - Feature #11227: May it be possible to add some symbols to IO.new() ?https://redmine.ruby-lang.org/issues/11227?journal_id=527742015-06-05T22:48:55Znormalperson (Eric Wong)normalperson@yhbt.net
<ul></ul><p><a href="mailto:shevegen@gmail.com" class="email">shevegen@gmail.com</a> wrote:</p>
<blockquote>
<p><code>IO.new()</code> wants a number.</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="n">io</span> <span class="o">=</span> <span class="no">IO</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
</code></pre>
<p>Would it be possible or desirable to also allow symbols?</p>
<p>Such as:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="n">io</span> <span class="o">=</span> <span class="no">IO</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="ss">:stdout</span><span class="p">)</span>
</code></pre>
<p>The <code>:stdout</code> seems to make it slightly easier for me<br>
to remember which of the variants (0,1,2) is which<br>
(<code>stdin</code>, <code>stdout</code>, <code>stderr</code>).</p>
</blockquote>
<p>I don't see the point.</p>
<p>Why not use existing <code>STDIN</code>, <code>STDOUT</code>, <code>STDERR</code> (or <code>$stdin</code>, <code>$stdout</code>, <code>$stderr</code>)?<br>
No need to allocate new <code>IO</code> objects.</p> Ruby master - Feature #11227: May it be possible to add some symbols to IO.new() ?https://redmine.ruby-lang.org/issues/11227?journal_id=527812015-06-06T03:57:31Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Description</strong> updated (<a title="View differences" href="/journals/52781/diff?detail_id=38048">diff</a>)</li><li><strong>Status</strong> changed from <i>Open</i> to <i>Feedback</i></li></ul><p>Or maybe <code>STDIN.dup</code>?</p>