RFC 30 (v2) STDIN, STDOUT, and STDERR should be renamed
[email protected] (Perl6 RFC Librarian) 12 Aug 2000 08:49:00 -0000
| Newsgroups | perl.perl6.language.io,perl.perl6.announce |
|---|---|
| Message-ID | <[email protected]> |
This and other RFCs are available on the web at http://dev.perl.org/rfc/ =head1 TITLE STDIN, STDOUT, and STDERR should be renamed =head1 VERSION Maintainer: Nathan Wiger <[email protected]> Date: 04 Aug 2000 Last-Modified: 12 Aug 2000 Version: 2 Mailing List: [email protected] Number: 30 Status: Frozen =head1 ABSTRACT Consensus has been reached that filehandles (currently barewords) will be renamed to use the leading $ type, to make them consistent with Perl. STDIN, STDOUT, and STDERR should follow suit and be renamed $STDIN, $STDOUT, and $STDERR. In addition, this RFC recommends deprecating select(), since it is no longer needed with the new fileobject approach described in RFC 14. =head1 DESCRIPTION Currently, filehandles are barewords, such as FILE and PIPE. However, for Perl 6 these are planned to be renamed to true "single-whatzitz" types (thanks Tom) and prefixed with a $. So, the current: print FILE "$stuff\n"; Will become something like: print $fh "$stuff\n"; STDIN, STDOUT, and STDERR need to follow suit. We should change print STDERR "$stuff\n"; to: print $STDERR "$stuff\n"; This makes them consistent with other Perl variables, such as @ARGV, %ENV, $VERSION, etc, all of which have the correct distiguishing prefix for their type. =head1 IMPLEMENTATION All references to STDIN, STDOUT, and STDERR will have to be changed. Also, select() is deprecated by this new approach and can be removed. This code block: $oldoutput = select($newoutput); Can now be written simply as reassignments: $oldoutput = $STDOUT; $STDOUT = $filehandle; The concept of a "currently selected filehandle" is no longer necessary. If print is called without arguments, it will call "print $STDOUT" ($STDOUT->print) which will inherit whatever print exists in whatever object $STDOUT references. =head1 CHANGES This RFC was frozen at version 2 on 12 Aug 2000. =head1 REFERENCES RFC14: Modify open() to support FileObjects and Extensibility