At 06:17 PM 8/29/00 -0600, Tom Christiansen wrote:
> >Eliminate bareword filehandles.
>
>"Eliminate" is such a strong word.  You're saying that we can't
>use STDIN, STDOUT, STDERR, ARGV, or DATA anymore?

There are some people I would like to stop using output filehandles, yes :-)

>   Heck, some people
>still use stdin and stdout! :-)

The RFC is absent a necessary discussion of what to do with the global 
filehandles.  Some people have already suggested renaming them; RFC 30 
takes the obvious step of making $STDIN, $STDOUT, $STDERR but sidesteps the 
issue of $ARGV which already has a meaning :-(  If we can solve that one 
then I'd just make all those filehandles scalars.  Backwards compatability 
hit but worth it in simplification IMHO.  I recall an earlier discussion 
about the $ prefix meaning a singular whatzit... as a filehandle clearly is...

Any ideas on what to do with the existing $ARGV if it became the 
filehandle?  Can it be one of those magical things that knows when it's 
being used as a filehandle and Do The Right Thing?

> >=head1 ABSTRACT
>
> >Now that scalars (objects) can be used for filehandles, the bareword form
> >should be eliminated.
>
>If true, doesn't that argument hold true for functions, too?

That wasn't the entirety of my argument :-)  It's not a sufficient reason 
per se.

>  If
>all non-method functions were stored in only in variables, I guarantee
>you that it would be rather harder to call a non-method function
>as though it were a method.
>
> >=head1 DESCRIPTION
>
> >The venerable bareword form of the filehandle leads to code that is
> >unnecessarily abstruse given that they can now be stored in
> >scalars.  Bareword filehandles are not lexical, and require the use of
> >typeglobs and C<local> to pass them to subroutines, concepts unnecessarily
> >advanced for such a beginner-type operation.
>
>It does?
>
>     sub p {
>         my $fh = shift;
>         print $fh "got it\n";
>     }
>     p(STDOUT);
>
>Of course, that's a bit dicey because STDOUT is omniglobal.   You
>could pass it as
>
>     p(*FH);
>
>instead, and the function's definition doesn't change.  What I tell
>people is that if they want, they can just pretend, even though
>it's not quite true, that * is the type symbol for a filehandle
>at least when it comes to passing it or storing in somewhere.
>This works out quite well.

This is true; but won't it make even more sense, and less pretense, just to 
pass filehandles around in scalars?


--
Peter Scott
Pacific Systems Design Technologies

Reply via email to