develooper Front page | perl.perl5.porters | Postings from July 2000

Re: [ID 20000415.002] v.5.6.0

Thread Previous
From:
Jarkko Hietaniemi
Date:
July 31, 2000 11:14
Subject:
Re: [ID 20000415.002] v.5.6.0
Message ID:
20000730141612.B11017@chaos.wustl.edu
On Sat, Apr 15, 2000 at 02:31:35PM -0400, Ilya Zakharevich wrote:
> On Sat, Apr 15, 2000 at 02:01:44PM -0400, Ronald J Kimball wrote:
> > > > Ex2:
> > > >   @_ = map{
> > > >       $_ += 1;
> > > >   }(5,2,7,0,7,7);
> > > > 
> > > >   Exception: Modification of a read-only value attempted at 1.pl line 1
> > > 
> > > Why are you surprised?  Did you mean map {$_ + 1} ?
> > 
> > He's surprised because this doesn't produce the same error:
> > 
> > @_ = map {
> >     $_ += 1;
> > } 1 .. 6;
> 
> Oh, *this* bug:
> 
> > perl -wle "sub a {map {print; ++$_} 1..3} a;print'';a"
> 1
> 2
> 3
> 
> 2
> 3
> 4
> 
> It was discussed here many years ago already.  It is my long-held
> opinion that these values (produced at compile time) should be marked
> read-only.

$opinion = 'agreed';
$patches = 'welcome';

> Ilya

-- 
$jhi++; # http://www.iki.fi/jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen

Thread Previous


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