RFC 215 (v1) More defaulting to C<$_>.

[email protected] (Perl6 RFC Librarian)
Newsgroups perl.perl6.announce.rfc,perl.perl6.language
Message-ID <[email protected]>
This and other RFCs are available on the web at
  http://dev.perl.org/rfc/

=head1 TITLE

More defaulting to C<$_>.

=head1 VERSION

    Maintainer: Kenneth C. Rich <[email protected]>
    Date: 12 Sep 2000
    Mailing List: [email protected]
    Number: 215
    Version: 1
    Status: Developing

=head1 ABSTRACT

$_ is the default variable for some operations.
Some other operations might benefit from similar use of
$_ to reduce clutter.

=head1 DESCRIPTION

An inconsistency between "C<print>" and "<>" bugs me:  "C<print;>" means
"C<print $_;>" so it seems like "<>" should mean "C<$_ = > <>".
I can't yet think of code that this extension would break.

Would this have an advantage in making the

 while( <> ) {
 }

syntax less magical?

Actually, some days I wish "print;" meant print nothing.  I was tempted
to title this RFC "Make print and <> consistent."

I also would like making "push;" mean "push( @_, $_ );" and "pop;" mean
"$_ = pop;" but I B<can> think of code this would break.  The same 
wish and problem applies to other list operators.  But maybe the problems
are easily fixed with the 5-to-6 converter changing perl5 "pop;" into
"undef = pop;" etc.  Which ugliness is more preferable?

"gethostbyaddr;" could use $_, and so on.

Parts of this proposal may work nicely with 
RFC 170: "Generalize =~ to a special-purpose assignment operator".

=head1 IMPLEMENTATION

...

=head1 REFERENCES

RFC 2: Request for new pragma: Implicit

RFC 51: Angle brackets should accept filenames and lists

RFC 56: Optional 2nd argument to pop() and shift()

RFC 170: Generalize =~ to a special-purpose assignment operator
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.