This and other RFCs are available on the web at
  http://dev.perl.org/rfc/

=head1 TITLE

Filehandles should use C<*> as a type prefix if typeglobs are eliminated.

=head1 VERSION

     Maintainer: Peter Scott <[EMAIL PROTECTED]>
     Date: 5 Aug 2000
     Version: 3
     Mailing List: [EMAIL PROTECTED]
     Status: Retracted
     Number: 10

=head1 ABSTRACT

Version 1 of this RFC stated: "The lack of a type-defining punctuation 
character prefix for filehandles makes them second-class variables in Perl. 
If typeglobs are eliminated in Perl 6, the C<*> character would become 
available as a type prefix character and could be used for filehandles."

Versions 2 and 3 withdraw this request, contingent upon the removal of 
bareword filehandles in Perl 6.  If scalars or objects in scalars (C<$fh>) 
are used for filehandles everywhere then there is no need to make a new 
type out of them.  The rest of the original RFC is left below for archival 
purposes.

=head1 DESCRIPTION

To pass filehandles around one either has to use a typeglob (C<local *FH>) 
or put them in a scalar (C<my $fh = new FileHandle> or the 5.6 C<open $fh, 
...>), at which point you can't tell that they're filehandles without the 
right context.

There have been serious proposals to eliminate typeglobs in Perl 6. If they 
get axed, the C<*> character could be reused for another datatype and the 
filehandle is fortuitously closely related.

The mental jump is fairly small, since most people other than module 
developers only ever saw C<*> used for filehandles anyway:

     local *FH;
     open (FH, ...);

This proposal would change that to

     open (my *fh, ...);

=head1 IMPLEMENTATION

Backwards compatibility takes a hit unless the current filehandle syntax is 
grandfathered in; I am not taking a position on whether it should be. Since 
it is contingent upon typeglobs being eliminated, it won't break any 
existing code that already uses typeglobs that won't be broken anyway.

Use of C<readline>s will now look like

     while (<*fh>) { ...

which means that the use of the angle operator for globbing also has to go. 
As if an excuse were needed.

This proposal also applies to directory handles.

=head1 REFERENCES

L<perlopentut>

Reply via email to