develooper Front page | perl.perl5.porters | Postings from September 2013

Re: [perl #120047] perl should enable "$_" for use before callingsubs

Thread Previous | Thread Next
From:
Ricardo Signes
Date:
September 29, 2013 23:20
Subject:
Re: [perl #120047] perl should enable "$_" for use before callingsubs
Message ID:
20130929232022.GB20152@cancer.codesimply.com
* Linda Walsh <perlbug-followup@perl.org> [2013-09-29T05:26:28]
> I wasn't sure if this should be filed as a bug but the more
> I think about it, perl without "$_" would be like making 
> hardware registers read-only then calling subroutines and expecting
> them to work without their main registers.

I have to say, I really don't follow this bug report.  I think it would help if
you *led* with:

  1. what the program says
  2. what you expect to happen when it is run
  3. what happens instead

Further explication can follow.

I *think* you are saying that $_ should be mutable in all cases, so that code
expecting to assign to $_ will not die based in its input.

If this is a correct reading, it does not seem like a change for the better.
When $_ is an alias to an existing variable that cannot be changed (because,
for example, it is a constant) then trying to change it should be fatal.  The
alternative is either to allow constants to be mutable or to make mutation
sometimes have no effect on the intended variable.

Finally, you are still using "P.pm" in code that could be made easy to run with
a stock installation, which makes it less trivial to run your example program.
Please don't do that.  It's easier if you use Data::Dumper or dumpvars.pl or
something that one has immediately after building blead.

-- 
rjbs

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About