Hearing no outright derision in response to my trial balloon, here it is as 
an RFC:


=head1 TITLE

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

=head1 VERSION

   Maintainer: Peter Scott <[EMAIL PROTECTED]>
   Date: 2 Aug 2000
   Version: 1
   Mailing List: perl6-language
   Number: TBD

=head1 ABSTRACT

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.

=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>
--
Peter Scott
Pacific Systems Design Technologies

Reply via email to