Project

General

Profile

Actions

Feature #11227

closed

May it be possible to add some symbols to IO.new() ?

Feature #11227: May it be possible to add some symbols to IO.new() ?

Added by shevegen (Robert A. Heiler) over 10 years ago. Updated over 10 years ago.

Status:
Feedback
Assignee:
-
Target version:
-
[ruby-core:69470]

Description

Hello.

IO.new() wants a number.

io = IO.new(1)

Would it be possible or desirable to also allow symbols?

Such as:

io = IO.new(:stdout)

The :stdout seems to make it slightly easier for me
to remember which of the variants (0,1,2) is which
(stdin, stdout, stderr).

Updated by normalperson (Eric Wong) over 10 years ago Actions #1 [ruby-core:69471]

wrote:

IO.new() wants a number.

io = IO.new(1)

Would it be possible or desirable to also allow symbols?

Such as:

io = IO.new(:stdout)

The :stdout seems to make it slightly easier for me
to remember which of the variants (0,1,2) is which
(stdin, stdout, stderr).

I don't see the point.

Why not use existing STDIN, STDOUT, STDERR (or $stdin, $stdout, $stderr)?
No need to allocate new IO objects.

Updated by nobu (Nobuyoshi Nakada) over 10 years ago Actions #2 [ruby-core:69480]

  • Description updated (diff)
  • Status changed from Open to Feedback

Or maybe STDIN.dup?

Actions

Also available in: PDF Atom