=head1 TITLE Replace default filehandle/select with $DEFOUT, $DEFERR, $DEFIN =head1 VERSION Maintainer: Nathan Wiger Date: 17 Aug 2000 Last Modified: 13 Sep 2000 Mailing List: perl6-language-io@perl.org Number: 129 Version: 2 Status: Frozen =head1 ABSTRACT A basic Perl 5 implementation can be found as IO::Default at http://www.perl.com/CPAN/authors/id/N/NW/NWIGER/IO-Default-1.03.tar.gz The concept of a "default filehandle" is nebulous. Many users can't get their heads around it, and even if they can, it is still kind of mysterious. This proposes that the "default filehandle" and 1-arg select be dropped from Perl 6 and replaced with the variable C<$DEFOUT>, the Default Output handle. Whatever this variable contains will be what is printed to by default. This will make default output consistent with the C approach and also other Perl special variables. In addition, this RFC proposes the addition of two new variables, C<$DEFERR> and C<$DEFIN>, the Default Error and Default Input handles. These can be used to redirect default error output and default input, for added flexibility. =head1 NOTES ON FREEZE Some discussion, particularly by Jon Ericson, was recorded on this RFC. Most of it boiled down to clarifications of issues. Jon questioned the usefulness of C<$DEFERR>, but I think it serves a very useful purpose since it allows you to redirect warnings (which would be directed to C<$DEFERR>) without affecting statements that print to C<$STDERR> explicitly. There is also very nice symmetry between the C default handles and the C standard handles. =head1 DESCRIPTION =head2 $DEFOUT Currently, the "default filehandle" ("DF" to save typing) is hidden. It can only be accessed or changed via the C. Make sure p52p6 translates C syntax would have to be translated to something like: $DEFOUT = $FILE; # was select(FILE); Since the only other thing that would really change would be the meaning of <> in loops, p52p6 would have to translate while(<>) to: while (<$ARGV>) { } However, when used outside of a loop, like so: @file = <>; No translation would have to take place since the usage would likely be a shortcut to C (which would be retained since <> == C<$DEFIN> == C<$STDIN> by default). =head1 NOTES [1] This RFC does not take a firm stance on eliminating $|, $/, $\, and friends. However, this approach to handling default input and output does mean they are no longer needed. I do think they should go, but this RFC does not require it. [2] It is possible in a way, but you can't print to STDERR explicitly, and you have to use a series of open calls. Better to just send it to the default error handle, whatever that may contain. =head1 REFERENCES RFC 14: Modify open() to support FileObjects and Extensibility RFC 30: STDIN, STDOUT, and STDERR should be renamed http://www.mail-archive.com/perl6-language-io%40perl.org/msg00182.html http://www.mail-archive.com/perl6-language-io%40perl.org/msg00228.html