[% setvar title Filehandles should use C<*> as a type prefix if typeglobs are eliminated. %]
Note: these documents may be out of date. Do not use as reference! |
To see what is currently happening visit http://www.perl6.org/
Filehandles should use *
as a type prefix if typeglobs are eliminated.
Maintainer: Peter Scott <peter@psdt.com> Date: 5 Aug 2000 Mailing List: perl6-language@perl.org Number: 10 Version: 3 Status: Retracted
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 *
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 ($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.
To pass filehandles around one either has to use a typeglob (local *FH
)
or put them in a scalar (my $fh = new FileHandle
or the 5.6 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 *
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 *
used for filehandles anyway:
local *FH; open (FH, ...);
This proposal would change that to
open (my *fh, ...);
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 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.