develooper Front page | perl.perl5.porters | Postings from November 2009

Re: [PATCH] Perl RT#3105 Mark elements of constant range as readonly

Thread Previous | Thread Next
From:
Eirik Berg Hanssen
Date:
November 26, 2009 08:07
Subject:
Re: [PATCH] Perl RT#3105 Mark elements of constant range as readonly
Message ID:
7xfx818e49.fsf@blackbox.eirik.dav
Abigail <abigail@abigail.be> writes:

> I probably missed it, but which bug is being fixed by forbidding to 
> modify the iterator in C<< for $iterator (RANGE) >>?

  If nothing else, the bug that arises when someone replaces that
C<for> with a C<map> (minimal example):

perl -e 'sub a { print($_++) for 1..3; print $/ } a;a;a'
123
123
123

perl -e 'sub a { map print($_++), 1..3; print $/ } a;a;a'
123
234
345


Eirik
-- 
"[..] the buzz about Ruby and Rails is the sound of a bunch of
Java programmers finally discovering how cool Perl is."
                -- Piers Cawley

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